hashabler
hashabler copied to clipboard
Automatically deriving Hashable instances
I'd like to add TemplateHaskell
to support automatically deriving Hashable
instances for users' datatypes. These should replicate instances for Either
, tuples, ()
, Maybe
, but not necessarly []
( as I haven't quite figured out the rule there).
The only slight trickiness is we want to make sure to only constrain the deriving type's parameters to Hashable
when it appears in the RHS (i.e. phantom type parameters should not be constrained to Hashable
).
I don't think it's worth using GHC.Generics
since it's nearly as awful to use and probably much slower.
Although it's probably a requirement that I implement a drop-in replacement to hashable
's auto-deriving with GHC.Generics if I want this library to have any traction (that way e.g. unordered-containers
could switch to this without too much breakage.).