ekmett / kan-extensions

Kan extensions, Kan lifts, the Yoneda lemma, and (co)monads generated by a functor
Other
78 stars 33 forks source link

Export Curried Yoneda utils #72

Open treeowl opened 2 years ago

treeowl commented 2 years ago

lens uses Curried (Yoneda f) (Yoneda f) and an internal liftCurriedYoneda to implement confusing. There are other applications where these pieces are more useful separately. For example, you can use a class

class GTraversable t where
  gtraverse :: (a -> f b) -> t a -> Curried (Yoneda f) (Yoneda f) a

to implement generic deriving of Traversable that seems to work almost exactly the same as GHC deriving (if you use a modified form of Generic1). Perhaps it would even make sense to add a CurriedYoneda type and explain what it can do for you.