ftraverse :: (Applicative m)=> (forall x. f x -> m (g x)) -> t f -> m (t g)ftraverseMap :: (Applicative m)=> (t g -> r) -> (forall x. f x -> m (g x)) -> t f -> m r
Although it is more complicated, ftraverseMap gives slightly better
ergonomics when defining instances (e.g. ftraverseMap g f = ftraverseMap (g . to1) f . from1 rather than `ftraverse f = fmap to1 . ftraverse f . from1). For
lifted tuples the ergonomics are worse in proportion to the size of the tuple.
This likely eliminates the need for confusing in the generic definition
because the map over the Applicative is already fused. It should also allow
GeneralizedNewtypeDeriving.
ftraverse :: (Applicative m)=> (forall x. f x -> m (g x)) -> t f -> m (t g)
ftraverseMap :: (Applicative m)=> (t g -> r) -> (forall x. f x -> m (g x)) -> t f -> m r
Although it is more complicated,
ftraverseMap
gives slightly better ergonomics when defining instances (e.g.ftraverseMap g f = ftraverseMap (g . to1) f . from1
rather than `ftraverse f = fmap to1 . ftraverse f . from1). For lifted tuples the ergonomics are worse in proportion to the size of the tuple.This likely eliminates the need for
confusing
in the generic definition because the map over the Applicative is already fused. It should also allow GeneralizedNewtypeDeriving.