Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stg.Machine.Evaluate.Common
Description
Definitions useful for all state transition modules.
- data PrimError = Div0
- applyPrimOp :: PrimOp -> Integer -> Integer -> Validate PrimError Integer
- data AltMatch alt
- = AltMatches alt
- | DefaultMatches DefaultAlt
- data AltError = BadAlt
- lookupAlgebraicAlt :: Alts -> Constr -> Validate AltError (AltMatch AlgebraicAlt)
- lookupPrimitiveAlt :: Alts -> Literal -> Validate AltError (AltMatch PrimitiveAlt)
Primops
applyPrimOp :: PrimOp -> Integer -> Integer -> Validate PrimError Integer Source #
Apply a primop to two actual integers
Algebraic matching
Successful alternative match, used for finding the right branch in case
Constructors
AltMatches alt | |
DefaultMatches DefaultAlt |
Possible errors when looking up alternatives
Constructors
BadAlt | Algebraic/primitive alternative in primitive/algebraic case |
lookupAlgebraicAlt :: Alts -> Constr -> Validate AltError (AltMatch AlgebraicAlt) Source #
Look up an algebraic constructor among the given alternatives, and return the first match. If nothing matches, return the default alternative.
Primitive matching
lookupPrimitiveAlt :: Alts -> Literal -> Validate AltError (AltMatch PrimitiveAlt) Source #
lookupAlgebraicAlt
for primitive literals.