Copyright | (c) 2014 Justus Sagemüller |
---|---|
License | GPL v3 (see COPYING) |
Maintainer | (@) jsag $ hvl.no |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Data.Traversable.Constrained
Description
Synopsis
- class (Category k, Category l, Functor s l l, Functor t k k) => Traversable (s :: Type -> Type) (t :: Type -> Type) (k :: Type -> Type -> Type) (l :: Type -> Type -> Type) | s k l -> t, t k l -> s, s t k -> l, s t l -> k where
- type TraversalObject (k :: Type -> Type -> Type) (t :: Type -> Type) b
- traverse :: (Monoidal f k l, Object l a, Object l (s a), ObjectPair k b (t b), ObjectPair l (f b) (f (t b)), TraversalObject k t b) => l a (f b) -> l (s a) (f (t b))
- mapM :: (k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => k a (m b) -> k (t a) (m (t b))
- sequence :: (k ~ l, s ~ t, Monoidal f k k, ObjectPair k a (t a), ObjectPair k (f a) (f (t a)), Object k (t (f a)), TraversalObject k t a) => k (t (f a)) (f (t a))
- forM :: forall s t (k :: Type -> Type -> Type) m a b l. (Traversable s t k l, Monoidal m k l, Function l, Object k b, Object k (t b), ObjectPair k b (t b), Object l a, Object l (s a), ObjectPair l (m b) (m (t b)), TraversalObject k t b) => s a -> l a (m b) -> m (t b)
- type EndoTraversable (t :: Type -> Type) (k :: Type -> Type -> Type) = Traversable t t k k
- haskTraverse :: (Traversable t, Monoidal f (->) (->)) => (a -> f b) -> t a -> f (t b)
Documentation
class (Category k, Category l, Functor s l l, Functor t k k) => Traversable (s :: Type -> Type) (t :: Type -> Type) (k :: Type -> Type -> Type) (l :: Type -> Type -> Type) | s k l -> t, t k l -> s, s t k -> l, s t l -> k where Source #
Minimal complete definition
Methods
traverse :: (Monoidal f k l, Object l a, Object l (s a), ObjectPair k b (t b), ObjectPair l (f b) (f (t b)), TraversalObject k t b) => l a (f b) -> l (s a) (f (t b)) Source #
mapM :: (k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => k a (m b) -> k (t a) (m (t b)) Source #
traverse
, restricted to endofunctors. May be more efficient to implement.
sequence :: (k ~ l, s ~ t, Monoidal f k k, ObjectPair k a (t a), ObjectPair k (f a) (f (t a)), Object k (t (f a)), TraversalObject k t a) => k (t (f a)) (f (t a)) Source #
Instances
forM :: forall s t (k :: Type -> Type -> Type) m a b l. (Traversable s t k l, Monoidal m k l, Function l, Object k b, Object k (t b), ObjectPair k b (t b), Object l a, Object l (s a), ObjectPair l (m b) (m (t b)), TraversalObject k t b) => s a -> l a (m b) -> m (t b) Source #
type EndoTraversable (t :: Type -> Type) (k :: Type -> Type -> Type) = Traversable t t k k Source #
A traversable that can be used with mapM
.
haskTraverse :: (Traversable t, Monoidal f (->) (->)) => (a -> f b) -> t a -> f (t b) Source #
Use this if you want to “derive” a constrained traversable instance from a
given Traversable
one. (You will not be able to simply set
, because the latter requires the Prelude version
of traverse
= traverse
Applicative
, which can not be inferred from the constrained Monoidal
.