compdata-0.3: Compositional Data Types

Portabilitynon-portable (GHC Extensions)
MaintainerTom Hvitved <>



This module defines traversable higher-order difunctors.



class (HDifunctor f, Monad m) => HDitraversable f m a whereSource

HDifunctors representing data structures that can be traversed from left to right.


hdimapM :: NatM m b c -> NatM m (f a b) (f a c)Source


(HDifunctor f, Monad m, HTraversable (f a)) => HDitraversable f m a

If a higher-order difunctor is HTraversable for a given contravariant argument a, then it is HDitraversable for all Monads m with the same a.

HDitraversable f m a => HDitraversable (:&: f p) m a 
(HDitraversable f m a, HDitraversable g m a) => HDitraversable (:+: f g) m a 

class HFoldable t => HTraversable t whereSource


hmapM :: Monad m => NatM m a b -> NatM m (t a) (t b)Source

Map each element of a structure to a monadic action, evaluate these actions from left to right, and collect the results.

Alternative type in terms of natural transformations using functor composition :.::

hmapM :: Monad m => (a :-> m :.: b) -> t a :-> m :.: (t b)

htraverse :: Applicative f => NatM f a b -> NatM f (t a) (t b)Source