Copyright | (c) 2011 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | None |
Language | Haskell98 |
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
- data Cxt h f a i where
- data Hole
- data NoHole
- type Context = Cxt Hole
- type ContextS fs a = CxtS Hole fs a
- type HFix f = Cxt NoHole f (K ())
- type Term fs = HFix (Sum fs)
- type CxtS h fs a = Cxt h (Sum fs) a
- type Const (f :: (* -> *) -> * -> *) = f (K ())
- constTerm :: HFunctor f => Const f :-> HFix f
- unTerm :: HFix f t -> f (HFix f) t
- toCxt :: HFunctor f => HFix f :-> Context f a
- simpCxt :: HFunctor f => f a i -> Context f a i
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 Hole
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.
Instances
Generic (f (HFix f) l) => Generic (HFix f l) Source # | |
HFunctor f => HFunctor (Cxt h f) Source # | |
HFoldable f => HFoldable (Cxt h f) Source # | |
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 # | |
HTraversable f => HTraversable (Cxt h f) Source # | |
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 # | |
EqHF f => EqHF (Cxt h f) Source # | |
(HFunctor f, OrdHF f) => OrdHF (Cxt h f) Source # | From an |
(ShowHF f, HFunctor f) => ShowHF (Cxt h f) Source # | |
(EqHF f, KEq a) => KEq (Cxt h f a) Source # | |
(HFunctor f, OrdHF f, KOrd a) => KOrd (Cxt h f a) Source # | |
(ShowHF f, HFunctor f, KShow a) => KShow (Cxt h f a) Source # | |
(EqHF f, KEq a) => Eq (Cxt h f a i) Source # | From an |
(HFunctor f, OrdHF f, KOrd a) => Ord (Cxt h f a i) Source # | Ordering of terms. |
Defined in Data.Comp.Multi.Ordering | |
KShow (Cxt h f a) => Show (Cxt h f a i) Source # | |
type Rep (HFix f l) Source # | |
Defined in Data.Comp.Multi.Derive.Generic |
Phantom type that signals that a Cxt
does not contain holes.
constTerm :: HFunctor f => Const f :-> HFix 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 :: HFix f t -> f (HFix f) t Source #
This function unravels the given term at the topmost layer.