compdata-0.13.1: 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.Term

Description

This module defines the central notion of mutual recursive (or, higher-order) terms and its generalisation to (higher-order) contexts. All definitions are generalised versions of those in Data.Comp.Term.

Synopsis

Documentation

data Cxt h f a i where Source #

This data type represents contexts over a signature. Contexts are terms containing zero or more holes. The first type parameter is supposed to be one of the phantom types Cxt and NoHole. The second parameter is the signature of the context. The third parameter is the type family of the holes. The last parameter is the index/label.

Constructors

Term :: f (Cxt h f a) i -> Cxt h f a i 
Hole :: a i -> Cxt Hole f a i 

Instances

Instances details
(ShowHF f, HFunctor f) => ShowHF (Cxt h f) Source # 
Instance details

Defined in Data.Comp.Multi.Show

Methods

showHF :: Alg (Cxt h f) (K String) Source #

showHF' :: Cxt h f (K String) :=> String Source #

EqHF f => EqHF (Cxt h f) Source # 
Instance details

Defined in Data.Comp.Multi.Equality

Methods

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

HFoldable f => HFoldable (Cxt h f) Source # 
Instance details

Defined in Data.Comp.Multi.Term

Methods

hfold :: Monoid m => Cxt h f (K m) :=> m Source #

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

hfoldr :: forall (a :: Type -> Type) b. (a :=> (b -> b)) -> b -> Cxt h f a :=> b Source #

hfoldl :: forall b (a :: Type -> Type). (b -> a :=> b) -> b -> Cxt h f a :=> b Source #

hfoldr1 :: (a -> a -> a) -> Cxt h f (K a) :=> a Source #

hfoldl1 :: (a -> a -> a) -> Cxt h f (K a) :=> a Source #

HFunctor f => HFunctor (Cxt h f) Source # 
Instance details

Defined in Data.Comp.Multi.Term

Methods

hfmap :: forall (f0 :: Type -> Type) (g :: Type -> Type). (f0 :-> g) -> Cxt h f f0 :-> Cxt h f g Source #

HTraversable f => HTraversable (Cxt h f) Source # 
Instance details

Defined in Data.Comp.Multi.Term

Methods

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

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

(HFunctor f, OrdHF f) => OrdHF (Cxt h f) Source #

From an OrdHF difunctor an Ord instance of the corresponding term type can be derived.

Instance details

Defined in Data.Comp.Multi.Ordering

Methods

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

(ShowHF f, HFunctor f, KShow a) => KShow (Cxt h f a) Source # 
Instance details

Defined in Data.Comp.Multi.Show

Methods

kshow :: Cxt h f a i -> K String i Source #

(EqHF f, KEq a) => KEq (Cxt h f a) Source # 
Instance details

Defined in Data.Comp.Multi.Equality

Methods

keq :: Cxt h f a i -> Cxt h f a j -> Bool Source #

(HFunctor f, OrdHF f, KOrd a) => KOrd (Cxt h f a) Source # 
Instance details

Defined in Data.Comp.Multi.Ordering

Methods

kcompare :: Cxt h f a i -> Cxt h f a j -> Ordering Source #

KShow (Cxt h f a) => Show (Cxt h f a i) Source # 
Instance details

Defined in Data.Comp.Multi.Show

Methods

showsPrec :: Int -> Cxt h f a i -> ShowS #

show :: Cxt h f a i -> String #

showList :: [Cxt h f a i] -> ShowS #

(EqHF f, KEq a) => Eq (Cxt h f a i) Source #

From an EqF functor an Eq instance of the corresponding term type can be derived.

Instance details

Defined in Data.Comp.Multi.Equality

Methods

(==) :: Cxt h f a i -> Cxt h f a i -> Bool #

(/=) :: Cxt h f a i -> Cxt h f a i -> Bool #

(HFunctor f, OrdHF f, KOrd a) => Ord (Cxt h f a i) Source #

Ordering of terms.

Instance details

Defined in Data.Comp.Multi.Ordering

Methods

compare :: Cxt h f a i -> Cxt h f a i -> Ordering #

(<) :: Cxt h f a i -> Cxt h f a i -> Bool #

(<=) :: Cxt h f a i -> Cxt h f a i -> Bool #

(>) :: Cxt h f a i -> Cxt h f a i -> Bool #

(>=) :: Cxt h f a i -> Cxt h f a i -> Bool #

max :: Cxt h f a i -> Cxt h f a i -> Cxt h f a i #

min :: Cxt h f a i -> Cxt h f a i -> Cxt h f a i #

data Hole Source #

Phantom type that signals that a Cxt might contain holes.

data NoHole Source #

Phantom type that signals that a Cxt does not contain holes.

type Context = Cxt Hole Source #

A context might contain holes.

type Term f = Cxt NoHole f (K ()) Source #

A (higher-order) term is a context with no holes.

type Const (f :: (Type -> Type) -> Type -> Type) = f (K ()) Source #

constTerm :: HFunctor f => Const f :-> Term f Source #

This function converts a constant to a term. This assumes that the argument is indeed a constant, i.e. does not have a value for the argument type of the functor f.

unTerm :: Term f t -> f (Term f) t Source #

This function unravels the given term at the topmost layer.

toCxt :: HFunctor f => Term f :-> Context f a Source #

Cast a term over a signature to a context over the same signature.

simpCxt :: HFunctor f => f a i -> Context f a i Source #