ekmett / adjunctions

Simple adjunctions
http://hackage.haskell.org/package/adjunctions
Other
44 stars 27 forks source link

Added RepresentableOf #45

Open Icelandjack opened 6 years ago

Icelandjack commented 6 years ago
class    (Representable f, Rep f ~ rep) => RepresentableOf rep f
instance (Representable f, Rep f ~ rep) => RepresentableOf rep f

letting us write

duplicateRepBy :: RepresentableOf rep f => (rep -> rep -> rep) -> f a -> f (f a)
duplicateRepBy plus w = tabulate (\m -> tabulate (index w . plus m))
Icelandjack commented 6 years ago

If this looks okay I should probably add for Contravariant as well.

Icelandjack commented 6 years ago

Does a FD make a difference

class    (Representable f, Rep f ~ rep) => RepresentableOf rep f | f -> rep
instance (Representable f, Rep f ~ rep) => RepresentableOf rep f 

I see you use them in hask

class    (Functor f, Dom f ~ p, Cod f ~ q) => FunctorOf p q f | f -> p q
instance (Functor f, Dom f ~ p, Cod f ~ q) => FunctorOf p q f