This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Description
Hi, Tim. This is more a question than a bug report, when I was inspecting d-p-extras code I saw a bug of lawless typeclasses. Those are used in order to be able to apply certain messages to a different types, however I'm curious if it's possible to remove amount of those.
For example:
Killable typeclass could be converted to
-- | Kill (instruct to exit) generic process, using 'kill' primitive.
killProc :: Resolvable p => p -> String -> Process ()
killProc r s = resolve r >>= traverse_ (flip kill $ s)
-- | Kill (instruct to exit) generic process, using 'exit' primitive.
exitProc :: (Resolvable p, Serializable m) => p -> m -> Process ()
exitProc r m = resolve r >>= traverse_ (flip exit $ m)
This will have the same effect as current instance as it's a catch-all instance and will not allow using non Resolvable types in it. If you want to allow a way to kill opaque (unresolvable) entities, you may want to use -XDefaultTypeSignatures and
instance Killable r where
killProc :: Resovable r => r -> String -> Process ()
killProc r s = resolve r >>= maybe (return ()) (flip kill $ s)
...
As I don't understand the all reasons behind all use typeclasses in d-p-* I'd like to know that, and if possible to make some work to remove amount of those, or introduce laws for them.