Copyright | (c) 2011 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 Term f = Cxt NoHole f (K ())
- type Const (f :: (Type -> Type) -> Type -> Type) = f (K ())
- constTerm :: HFunctor f => Const f :-> Term f
- unTerm :: Term f t -> f (Term f) t
- toCxt :: HFunctor f => Term 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 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.
Instances
(ShowHF f, HFunctor f) => ShowHF (Cxt h f) Source # | |
EqHF f => EqHF (Cxt h f) Source # | |
HFoldable f => HFoldable (Cxt h f) Source # | |
Defined in Data.Comp.Multi.Term 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 # | |
HFunctor f => HFunctor (Cxt h f) Source # | |
HTraversable f => HTraversable (Cxt h f) Source # | |
Defined in Data.Comp.Multi.Term | |
(HFunctor f, OrdHF f) => OrdHF (Cxt h f) Source # | From an |
(ShowHF f, HFunctor f, KShow a) => KShow (Cxt h f a) Source # | |
(EqHF f, KEq a) => KEq (Cxt h f a) Source # | |
(HFunctor f, OrdHF f, KOrd a) => KOrd (Cxt h f a) Source # | |
KShow (Cxt h f a) => Show (Cxt h f a i) 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 |
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.