ermine-0.6: Ermine

Copyright(c) Dan Doel and Edward Kmett 2013-2014
LicenseBSD3
MaintainerDan Doel <dan.doel@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Ermine.Pattern.Matrix

Contents

Description

 

Synopsis

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 

Fields

_cols :: [[Pattern t]]
 
_bodies :: [Claused c a]
 

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

patternMatrix

Methods

patternMatrix :: Lens' t (PatternMatrix t c a) Source

bodies :: Lens' t [Claused c a] Source

cols :: Lens' t [[Pattern t]] Source

Instances

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

data Claused c a Source

Constructors

Localized [Scope PatternPath (Scope Word64 c) a] (Guarded (Scope PatternPath (Scope Word64 c) a)) 
Raw (Guarded (Scope PatternPath c a)) 

Instances

Functor c => Functor (Claused c) 
Foldable c => Foldable (Claused c) 
Traversable c => Traversable (Claused c) 
(Eq a, Monad c, Eq1 c) => Eq (Claused c a) 
(Functor c, Show a, Show1 c) => Show (Claused c a) 

hoistClaused :: Functor c => (forall x. c x -> d x) -> Claused c a -> Claused d a Source