| Copyright | (c) Dan Doel and Edward Kmett 2013-2014 |
|---|---|
| License | BSD3 |
| Maintainer | Dan Doel <dan.doel@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Ermine.Pattern.Matrix
Contents
Description
- data PatternMatrix t c a = PatternMatrix {}
- class HasPatternMatrix t t c a | t -> t c a where
- patternMatrix :: Lens' t (PatternMatrix t c a)
- bodies :: Lens' t [Claused c a]
- cols :: Lens' t [[Pattern t]]
- defaultOn :: Applicative c => Int -> PatternMatrix t c a -> PatternMatrix t c (Var () (c a))
- splitOn :: Applicative c => Int -> PatternHead -> PatternMatrix t c a -> PatternMatrix t c (Var Word64 (c a))
- data Claused c a
- = Localized [Scope PatternPath (Scope Word64 c) a] (Guarded (Scope PatternPath (Scope Word64 c) a))
- | Raw (Guarded (Scope PatternPath c a))
- hoistClaused :: Functor c => (forall x. c x -> d x) -> Claused c a -> Claused d a
Pattern Matrix
data PatternMatrix t c a Source
Pattern matrices for compilation. The matrix is represented as a list of columns. There is also an extra column representing the guards.
Constructors
| PatternMatrix | |
Instances
| Functor c => Functor (PatternMatrix t c) | |
| Foldable c => Foldable (PatternMatrix t c) | |
| Traversable c => Traversable (PatternMatrix t c) | |
| (Eq t, Eq a, Monad c, Eq1 c) => Eq (PatternMatrix t c a) | |
| (Functor c, Show t, Show a, Show1 c) => Show (PatternMatrix t c a) | |
| HasPatternMatrix (PatternMatrix t c a) t c a |
class HasPatternMatrix t t c a | t -> t c a where Source
Minimal complete definition
Instances
| HasPatternMatrix (PatternMatrix t c a) t c a |
defaultOn :: Applicative c => Int -> PatternMatrix t c a -> PatternMatrix t c (Var () (c a)) Source
Computes the matrix that should be used recursively when defaulting on the specified column.
splitOn :: Applicative c => Int -> PatternHead -> PatternMatrix t c a -> PatternMatrix t c (Var Word64 (c a)) Source
Computes the matrix that should be used recursively when defaulting on the specified column, with the given pattern head.
Claused
Constructors
| Localized [Scope PatternPath (Scope Word64 c) a] (Guarded (Scope PatternPath (Scope Word64 c) a)) | |
| Raw (Guarded (Scope PatternPath c a)) |
hoistClaused :: Functor c => (forall x. c x -> d x) -> Claused c a -> Claused d a Source