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.Env

Description

 

Synopsis

Documentation

newtype PatternEnv Source

The environment necessary to perform pattern compilation. We need two pieces of information:

1) The signatures (full list of constructors) associated with each particular constructor

2) A mapping from constructors to their Core integer tag

This is accomplished via a map of maps. The outer map should take each global to its associated signature, and signatures are represented as maps from globals to integer tags.

Constructors

PatternEnv 

Fields

signatures :: HashMap Global (HashMap Global ([Convention], Word64))
 

class (Applicative m, Monad m) => MonadPattern m where Source

Monads that allow us to perform pattern compilation, by providing a PatternEnv.

Instances

isSignature :: MonadPattern m => Set PatternHead -> m Bool Source

Determines whether a set of pattern heads constitutes a signature. This is handled specially for tuples and literals, and relies on the monad for data type constructors.

constructorTag :: MonadPattern m => PatternHead -> m ([Convention], Word64) Source

Looks up the constructor tag for a pattern head. For tuples this is always 0, but constructors must consult the compilation environment.