| Copyright | James Koppel 2013 |
|---|---|
| License | BSD-style (see the LICENSE file in the distribution) |
| Safe Haskell | None |
| Language | Haskell98 |
Data.Comp.Multi.Strategy.Classification
Description
This module contains typeclasses and operations allowing dynamic casing on sorts.
Synopsis
- class DynCase f a where
- class KDynCase (f :: (* -> *) -> * -> *) a where
- dynProj :: forall f l l'. DynCase f l => f l' -> Maybe (f l)
- fromDynProj :: DynCase f l => f l' -> f l
- caseE :: DynCase f l => E f -> Maybe (f l)
- caseDyn :: DynCase f l => (f l -> r) -> f i -> r -> r
- subterms :: (DynCase (HFix f) l, HFoldable f) => HFix f l' -> [HFix f l]
- isSort :: forall e l. DynCase e l => Proxy l -> forall i. e i -> Bool
- kIsSort :: forall f l. KDynCase f l => Proxy l -> forall i e. f e i -> Bool
Documentation
class DynCase f a where Source #
This operation allows you to rediscover the label giving
the sort of a term by inspecting the term. It is mainly used
through the caseE and dynProj operators
class KDynCase (f :: (* -> *) -> * -> *) a where Source #
An instance KDynCase f a defines an instance DynCase (HFix f) a
dynProj :: forall f l l'. DynCase f l => f l' -> Maybe (f l) Source #
Takes a term t of unknown sort. Returns Just t if t is of sort l, and Nothing otherwise.
caseE :: DynCase f l => E f -> Maybe (f l) Source #
Inspect an existentially-quantified sort to determine if it is of sort l
Arguments
| :: DynCase f l | |
| => (f l -> r) | Function to run on term of sort |
| -> f i | Term of unknown sort |
| -> r | Default value |
| -> r |
Runs a sort-specific function on a term of unknown sort, returning a default value if it is of the wrong sort
subterms :: (DynCase (HFix f) l, HFoldable f) => HFix f l' -> [HFix f l] Source #
Gives all subterms of any given sort of a term