Copyright | (c) 2010-2011 Patrick Bahr, Tom Hvitved |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
This module provides operators on functors.
- data (f :+: g) e
- fromInl :: (f :+: g) e -> Maybe (f e)
- fromInr :: (f :+: g) e -> Maybe (g e)
- caseF :: (f a -> b) -> (g a -> b) -> (f :+: g) a -> b
- data Pos
- data Emb
- type family Elem f g :: Emb
- type family Choose f g e1 r :: Emb
- type family Sum' e1 r :: Emb
- data Proxy a = P
- class Subsume e f g where
- type family Or a b :: Bool
- type family AnyDupl f g
- type family Dupl f l :: Bool
- type family Dupl' l :: Bool
- type family Find f l :: Bool
- type family Find' f g :: Bool
- class NoDupl f g s
- type (:<:) f g = (Subsume (Elem f g) f g, NoDupl f g (AnyDupl f g))
- inj :: forall f g a. f :<: g => f a -> g a
- proj :: forall f g a. f :<: g => g a -> Maybe (f a)
- type (:=:) f g = (f :<: g, g :<: f)
- spl :: f :=: (f1 :+: f2) => (f1 a -> b) -> (f2 a -> b) -> f a -> b
- data (f :*: g) a = (f a) :*: (g a)
- ffst :: (f :*: g) a -> f a
- fsnd :: (f :*: g) a -> g a
- data (f :&: a) e = (f e) :&: a
- class DistAnn s p s' | s' -> s, s' -> p where
- class RemA s s' | s -> s' where
- remA :: s a -> s' a
Documentation
data (f :+: g) e infixr 6 Source
Formal sum of signatures (functors).
DistAnn k s p s' => DistAnn k ((:+:) k f s) p ((:+:) k ((:&:) k f p) s') | |
RemA k s s' => RemA k ((:+:) k ((:&:) k f p) s) ((:+:) k f s') | |
Subsume (Found p) f g => Subsume (Found (Ri p)) f ((:+:) * g' g) | |
Subsume (Found p) f g => Subsume (Found (Le p)) f ((:+:) * g g') | |
(Subsume (Found p1) f1 g, Subsume (Found p2) f2 g) => Subsume (Found (Sum p1 p2)) ((:+:) * f1 f2) g | |
(Functor f, Functor g) => Functor ((:+:) * f g) | |
(Foldable f, Foldable g) => Foldable ((:+:) * f g) | |
(Traversable f, Traversable g) => Traversable ((:+:) * f g) | |
(ShowConstr f, ShowConstr g) => ShowConstr ((:+:) * f g) | |
(ShowF f, ShowF g) => ShowF ((:+:) * f g) | |
(ArbitraryF f, ArbitraryF g) => ArbitraryF ((:+:) * f g) | Instances of |
(NFDataF f, NFDataF g) => NFDataF ((:+:) * f g) | |
(EqF f, EqF g) => EqF ((:+:) * f g) |
|
(OrdF f, OrdF g) => OrdF ((:+:) * f g) |
|
(Render f, Render g) => Render ((:+:) * f g) | |
(HasVars f v0, HasVars g v0) => HasVars ((:+:) * f g) v | |
(Desugar f h, Desugar g h) => Desugar ((:+:) * f g) h | |
(Eq (f a), Eq (g a)) => Eq ((:+:) * f g a) | |
(Ord (f a), Ord (g a)) => Ord ((:+:) * f g a) | |
(Show (f a), Show (g a)) => Show ((:+:) * f g a) |
caseF :: (f a -> b) -> (g a -> b) -> (f :+: g) a -> b Source
Utility function to case on a functor sum, without exposing the internal representation of sums.
type (:<:) f g = (Subsume (Elem f g) f g, NoDupl f g (AnyDupl f g)) infixl 5 Source
The :<: constraint is a conjunction of two constraints. The first
one is used to construct the evidence that is used to implement the
injection and projection functions. The first constraint alone
would allow instances such as F :+: F :<: F
or F :+: (F :+: G)
:<: F :+: G
which have multiple occurrences of the same
sub-signature on the left-hand side. Such instances are usually
unintended and yield injection functions that are not
injective. The second constraint excludes such instances.
data (f :&: a) e infixr 7 Source
This data type adds a constant product (annotation) to a signature.
(f e) :&: a infixr 7 |
DistAnn k f p ((:&:) k f p) | |
RemA k ((:&:) k f p) f | |
DistAnn k s p s' => DistAnn k ((:+:) k f s) p ((:+:) k ((:&:) k f p) s') | |
RemA k s s' => RemA k ((:+:) k ((:&:) k f p) s) ((:+:) k f s') | |
Functor f => Functor ((:&:) * f a) | |
Foldable f => Foldable ((:&:) * f a) | |
Traversable f => Traversable ((:&:) * f a) | |
(ShowConstr f, Show p) => ShowConstr ((:&:) * f p) | |
(ShowF f, Show p) => ShowF ((:&:) * f p) | |
(ArbitraryF f, Arbitrary p) => ArbitraryF ((:&:) * f p) | |
(NFDataF f, NFData a) => NFDataF ((:&:) * f a) |