compdata-0.13.0: Compositional Data Types
Copyright(c) 2011 Patrick Bahr
LicenseBSD3
MaintainerPatrick Bahr <paba@diku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Comp.Multi.Ops

Description

This module provides operators on higher-order functors. All definitions are generalised versions of those in Data.Comp.Ops.

Synopsis

Documentation

class RemA (s :: (Type -> Type) -> Type -> Type) s' | s -> s' where Source #

Methods

remA :: s a :-> s' a Source #

Instances

Instances details
RemA (f :&: p) f Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

remA :: forall (a :: Type -> Type). (f :&: p) a :-> f a Source #

RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

remA :: forall (a :: Type -> Type). ((f :&: p) :+: s) a :-> (f :+: s') a Source #

class DistAnn (s :: (Type -> Type) -> Type -> Type) p s' | s' -> s, s' -> p where Source #

This class defines how to distribute an annotation over a sum of signatures.

Methods

injectA :: p -> s a :-> s' a Source #

This function injects an annotation over a signature.

projectA :: s' a :-> (s a :&: p) Source #

Instances

Instances details
DistAnn f p (f :&: p) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

injectA :: forall (a :: Type -> Type). p -> f a :-> (f :&: p) a Source #

projectA :: forall (a :: Type -> Type). (f :&: p) a :-> (f a :&: p) Source #

DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

injectA :: forall (a :: Type -> Type). p -> (f :+: s) a :-> ((f :&: p) :+: s') a Source #

projectA :: forall (a :: Type -> Type). ((f :&: p) :+: s') a :-> ((f :+: s) a :&: p) Source #

data (f :&: a) (g :: Type -> Type) 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 ::  Type -> Type) e = f g e :&: a e

This is too general, however, for example for productHHom.

Constructors

(f g e) :&: a infixr 7 

Instances

Instances details
DistAnn f p (f :&: p) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

injectA :: forall (a :: Type -> Type). p -> f a :-> (f :&: p) a Source #

projectA :: forall (a :: Type -> Type). (f :&: p) a :-> (f a :&: p) Source #

(ShowHF f, Show p) => ShowHF (f :&: p) Source # 
Instance details

Defined in Data.Comp.Multi.Show

Methods

showHF :: Alg (f :&: p) (K String) Source #

showHF' :: (f :&: p) (K String) :=> String Source #

HFoldable f => HFoldable (f :&: a) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hfold :: Monoid m => (f :&: a) (K m) :=> m Source #

hfoldMap :: forall m (a0 :: Type -> Type). Monoid m => (a0 :=> m) -> (f :&: a) a0 :=> m Source #

hfoldr :: forall (a0 :: Type -> Type) b. (a0 :=> (b -> b)) -> b -> (f :&: a) a0 :=> b Source #

hfoldl :: forall b (a0 :: Type -> Type). (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 #

HFunctor f => HFunctor (f :&: a) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hfmap :: forall (f0 :: Type -> Type) (g :: Type -> Type). (f0 :-> g) -> (f :&: a) f0 :-> (f :&: a) g Source #

HTraversable f => HTraversable (f :&: a) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hmapM :: forall (m :: Type -> Type) (a0 :: Type -> Type) (b :: Type -> Type). Monad m => NatM m a0 b -> NatM m ((f :&: a) a0) ((f :&: a) b) Source #

htraverse :: forall (f0 :: Type -> Type) (a0 :: Type -> Type) (b :: Type -> Type). Applicative f0 => NatM f0 a0 b -> NatM f0 ((f :&: a) a0) ((f :&: a) b) Source #

RemA (f :&: p) f Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

remA :: forall (a :: Type -> Type). (f :&: p) a :-> f a Source #

DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

injectA :: forall (a :: Type -> Type). p -> (f :+: s) a :-> ((f :&: p) :+: s') a Source #

projectA :: forall (a :: Type -> Type). ((f :&: p) :+: s') a :-> ((f :+: s) a :&: p) Source #

RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

remA :: forall (a :: Type -> Type). ((f :&: p) :+: s) a :-> (f :+: s') a Source #

type (:=:) f g = (f :<: g, g :<: f) infixl 5 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.

class Subsume (e :: Emb) (f :: (Type -> Type) -> Type -> Type) (g :: (Type -> Type) -> Type -> Type) where Source #

Methods

inj' :: Proxy e -> f a :-> g a Source #

prj' :: Proxy e -> NatM Maybe (g a) (f a) Source #

type family Elem (f :: (Type -> Type) -> Type -> Type) (g :: (Type -> Type) -> Type -> Type) :: Emb where ... Source #

Equations

Elem f f = Found Here 
Elem (f1 :+: f2) g = Sum' (Elem f1 g) (Elem f2 g) 
Elem f (g1 :+: g2) = Choose (Elem f g1) (Elem f g2) 
Elem f g = NotFound 

data (f :+: g) (h :: Type -> Type) e infixr 6 Source #

Data type defining coproducts.

Constructors

Inl (f h e) 
Inr (g h e) 

Instances

Instances details
(ShowHF f, ShowHF g) => ShowHF (f :+: g) Source # 
Instance details

Defined in Data.Comp.Multi.Show

Methods

showHF :: Alg (f :+: g) (K String) Source #

showHF' :: (f :+: g) (K String) :=> String Source #

(EqHF f, EqHF g) => EqHF (f :+: g) Source #

EqF is propagated through sums.

Instance details

Defined in Data.Comp.Multi.Equality

Methods

eqHF :: forall (g0 :: Type -> Type) i j. KEq g0 => (f :+: g) g0 i -> (f :+: g) g0 j -> Bool Source #

(HFoldable f, HFoldable g) => HFoldable (f :+: g) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hfold :: Monoid m => (f :+: g) (K m) :=> m Source #

hfoldMap :: forall m (a :: Type -> Type). Monoid m => (a :=> m) -> (f :+: g) a :=> m Source #

hfoldr :: forall (a :: Type -> Type) b. (a :=> (b -> b)) -> b -> (f :+: g) a :=> b Source #

hfoldl :: forall b (a :: Type -> Type). (b -> a :=> b) -> b -> (f :+: g) a :=> b Source #

hfoldr1 :: (a -> a -> a) -> (f :+: g) (K a) :=> a Source #

hfoldl1 :: (a -> a -> a) -> (f :+: g) (K a) :=> a Source #

(HFunctor f, HFunctor g) => HFunctor (f :+: g) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hfmap :: forall (f0 :: Type -> Type) (g0 :: Type -> Type). (f0 :-> g0) -> (f :+: g) f0 :-> (f :+: g) g0 Source #

(HTraversable f, HTraversable g) => HTraversable (f :+: g) Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

hmapM :: forall (m :: Type -> Type) (a :: Type -> Type) (b :: Type -> Type). Monad m => NatM m a b -> NatM m ((f :+: g) a) ((f :+: g) b) Source #

htraverse :: forall (f0 :: Type -> Type) (a :: Type -> Type) (b :: Type -> Type). Applicative f0 => NatM f0 a b -> NatM f0 ((f :+: g) a) ((f :+: g) b) Source #

(OrdHF f, OrdHF g) => OrdHF (f :+: g) Source #

OrdHF is propagated through sums.

Instance details

Defined in Data.Comp.Multi.Ordering

Methods

compareHF :: forall (a :: Type -> Type) i j. KOrd a => (f :+: g) a i -> (f :+: g) a j -> Ordering Source #

(Desugar f h, Desugar g h) => Desugar (f :+: g) h Source # 
Instance details

Defined in Data.Comp.Multi.Desugar

Methods

desugHom :: Hom (f :+: g) h Source #

desugHom' :: forall (a :: Type -> Type). Alg (f :+: g) (Context h a) Source #

(HasVars f v, HasVars g v) => HasVars (f :+: g) v Source # 
Instance details

Defined in Data.Comp.Multi.Variables

Methods

isVar :: forall (a :: Type -> Type). (f :+: g) a :=> Maybe v Source #

bindsVars :: forall (m :: TYPE LiftedRep -> TYPE LiftedRep) (a :: Type -> Type). Mapping m a => (f :+: g) a :=> m (Set v) Source #

DistAnn s p s' => DistAnn (f :+: s) p ((f :&: p) :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

injectA :: forall (a :: Type -> Type). p -> (f :+: s) a :-> ((f :&: p) :+: s') a Source #

projectA :: forall (a :: Type -> Type). ((f :&: p) :+: s') a :-> ((f :+: s) a :&: p) Source #

RemA s s' => RemA ((f :&: p) :+: s) (f :+: s') Source # 
Instance details

Defined in Data.Comp.Multi.Ops

Methods

remA :: forall (a :: Type -> Type). ((f :&: p) :+: s) a :-> (f :+: s') a 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.

inj :: forall f g a. f :<: g => f a :-> g a Source #

proj :: forall f g a. f :<: g => NatM Maybe (g a) (f a) Source #

spl :: f :=: (f1 :+: f2) => (f1 a :-> b) -> (f2 a :-> b) -> f a :-> b Source #

data (f :*: g) a infixr 8 Source #

Formal product of signatures (functors).

Constructors

(f a) :*: (g a) infixr 8 

Instances

Instances details
(Foldable f, Foldable g) => Foldable (f :*: g) Source # 
Instance details

Defined in Data.Comp.Ops

Methods

fold :: Monoid m => (f :*: g) m -> m #

foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> 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] #

null :: (f :*: g) a -> Bool #

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 #

sum :: Num a => (f :*: g) a -> a #

product :: Num a => (f :*: g) a -> a #

(Traversable f, Traversable g) => Traversable (f :*: g) Source # 
Instance details

Defined in Data.Comp.Ops

Methods

traverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #

sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((f :*: g) a) #

mapM :: Monad m => (a -> m b) -> (f :*: g) a -> m ((f :*: g) b) #

sequence :: Monad m => (f :*: g) (m a) -> m ((f :*: g) a) #

(Functor f, Functor g) => Functor (f :*: g) Source # 
Instance details

Defined in Data.Comp.Ops

Methods

fmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b #

(<$) :: a -> (f :*: g) b -> (f :*: g) a #

ffst :: (f :*: g) a -> f a Source #

fsnd :: (f :*: g) a -> g a Source #