Copyright | (c) 2011 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe |
Language | Haskell98 |
This module provides operators on higher-order functors. All definitions are generalised versions of those in Data.Comp.Ops.
Synopsis
- class RemA (s :: (* -> *) -> * -> *) s' | s -> s' where
- class DistAnn (s :: (* -> *) -> * -> *) p s' | s' -> s, s' -> p where
- data (f :&: a) (g :: * -> *) e = (f g e) :&: a
- type (:=:) f g = (f :<: g, g :<: f)
- type (:<:) f g = Subsume (ComprEmb (Elem f g)) f g
- class Subsume (e :: Emb) (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) where
- type family Elem (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) :: Emb where ...
- data (f :+: g) (h :: * -> *) e
- caseH :: (f a b -> c) -> (g a b -> c) -> (f :+: g) a b -> c
- inj :: forall f g a. f :<: g => f a :-> g a
- proj :: forall f g a. f :<: g => NatM Maybe (g a) (f a)
- 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
Documentation
class DistAnn (s :: (* -> *) -> * -> *) p s' | s' -> s, s' -> p where Source #
This class defines how to distribute an annotation over a sum of signatures.
data (f :&: a) (g :: * -> *) e infixr 7 Source #
This data type adds a constant product to a signature. Alternatively, this could have also been defined as
data (f :&: a) (g :: * -> *) e = f g e :&: a e
This is too general, however, for example for productHHom
.
(f g e) :&: a infixr 7 |
Instances
DistAnn f p (f :&: p) Source # | |
HFunctor f => HFunctor (f :&: a) Source # | |
HFoldable f => HFoldable (f :&: a) Source # | |
Defined in Data.Comp.Multi.Ops hfold :: Monoid m => (f :&: a) (K m) :=> m Source # hfoldMap :: Monoid m => (a0 :=> m) -> (f :&: a) a0 :=> m Source # hfoldr :: (a0 :=> (b -> b)) -> b -> (f :&: a) a0 :=> b Source # hfoldl :: (b -> a0 :=> b) -> b -> (f :&: a) a0 :=> b Source # hfoldr1 :: (a0 -> a0 -> a0) -> (f :&: a) (K a0) :=> a0 Source # hfoldl1 :: (a0 -> a0 -> a0) -> (f :&: a) (K a0) :=> a0 Source # | |
HTraversable f => HTraversable (f :&: a) Source # | |
(ShowHF f, Show p) => ShowHF (f :&: p) Source # | |
RemA (f :&: p) f Source # | |
Defined in Data.Comp.Multi.Ops | |
DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # | |
RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # | |
type (:<:) f g = Subsume (ComprEmb (Elem f g)) f g infixl 5 Source #
A constraint f :<: g
expresses that the signature f
is
subsumed by g
, i.e. f
can be used to construct elements in g
.
data (f :+: g) (h :: * -> *) e infixr 6 Source #
Data type defining coproducts.
Instances
(HFunctor f, HFunctor g) => HFunctor (f :+: g) Source # | |
(HFoldable f, HFoldable g) => HFoldable (f :+: g) Source # | |
Defined in Data.Comp.Multi.Ops | |
(HTraversable f, HTraversable g) => HTraversable (f :+: g) Source # | |
(ShowHF f, ShowHF g) => ShowHF (f :+: g) Source # | |
(EqHF f, EqHF g) => EqHF (f :+: g) Source # |
|
(OrdHF f, OrdHF g) => OrdHF (f :+: g) Source # |
|
(HasVars f v, HasVars g v) => HasVars (f :+: g) v Source # | |
(Desugar f h, Desugar g h) => Desugar (f :+: g) h Source # | |
DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # | |
RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # | |
caseH :: (f a b -> c) -> (g a b -> c) -> (f :+: g) a b -> c Source #
Utility function to case on a higher-order functor sum, without exposing the internal representation of sums.
data (f :*: g) a infixr 8 Source #
Formal product of signatures (functors).
(f a) :*: (g a) infixr 8 |
Instances
(Functor f, Functor g) => Functor (f :*: g) Source # | |
(Foldable f, Foldable g) => Foldable (f :*: g) Source # | |
Defined in Data.Comp.Ops fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :*: g) Source # | |