Copyright | Copyright (C) 2015 Kyle Carter |
---|---|
License | BSD3 |
Maintainer | Kyle Carter <kylcarte@indiana.edu> |
Stability | experimental |
Portability | RankNTypes |
Safe Haskell | None |
Language | Haskell2010 |
FSum
is a type combinators for representing disjoint sums of
many functors (fs :: [k -> *])
at a single index (a :: k)
.
As opposed to one-functor-many-indices Sum
.
- data FSum :: [k -> *] -> k -> * where
- nilSumF :: FSum Ø a -> Void
- decompF :: FSum (f :< fs) a -> Either (f a) (FSum fs a)
- injF :: f ∈ fs => f a -> FSum fs a
- prjF :: f ∈ fs => FSum fs a -> Maybe (f a)
- injectFSum :: Index fs f -> f a -> FSum fs a
- indexF :: Index fs f -> FSum fs a -> Maybe (f a)
- imapF :: (forall f. Index fs f -> f a -> f b) -> FSum fs a -> FSum fs b
- ifoldMapF :: (forall f. Index fs f -> f a -> m) -> FSum fs a -> m
- itraverseF :: Functor g => (forall f. Index fs f -> f a -> g (f b)) -> FSum fs a -> g (FSum fs b)
Documentation
data FSum :: [k -> *] -> k -> * where Source
ListC ((<$>) Constraint (* -> *) Functor fs) => Functor (FSum * fs) Source | |
ListC ((<$>) Constraint (* -> *) Foldable fs) => Foldable (FSum * fs) Source | |
(ListC ((<$>) Constraint (* -> *) Functor fs), ListC ((<$>) Constraint (* -> *) Foldable fs), ListC ((<$>) Constraint (* -> *) Traversable fs)) => Traversable (FSum * fs) Source |
decompF :: FSum (f :< fs) a -> Either (f a) (FSum fs a) Source
Decompose a non-empty FSum into either its head or its tail.
injectFSum :: Index fs f -> f a -> FSum fs a Source
Inject an element into an FSum with an explicitly specified Index.
imapF :: (forall f. Index fs f -> f a -> f b) -> FSum fs a -> FSum fs b Source
Map over the single element in an FSum with a function that can handle any possible element, along with the element's index.