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 |
- newtype PatternEnv = PatternEnv {
- signatures :: HashMap Global (HashMap Global ([Convention], Word64))
- dummyPatternEnv :: PatternEnv
- class (Applicative m, Monad m) => MonadPattern m where
- askPattern :: m PatternEnv
- isSignature :: MonadPattern m => Set PatternHead -> m Bool
- constructorTag :: MonadPattern m => PatternHead -> m ([Convention], Word64)
- constructorGlobal :: PatternHead -> Global
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.
PatternEnv | |
|
Eq PatternEnv | |
Show PatternEnv | |
MonadPattern ((->) PatternEnv) |
class (Applicative m, Monad m) => MonadPattern m where Source
Monads that allow us to perform pattern compilation, by providing a PatternEnv.
askPattern :: m PatternEnv Source
MonadPattern ((->) PatternEnv) |
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.