stgi-1.1: Educational implementation of the STG (Spineless Tagless G-machine)

Safe HaskellNone
LanguageHaskell2010

Stg.Machine.Evaluate.Common

Contents

Description

Definitions useful for all state transition modules.

Synopsis

Primops

data PrimError Source #

Possible errors of primops

Constructors

Div0

Division by zero

applyPrimOp :: PrimOp -> Integer -> Integer -> Validate PrimError Integer Source #

Apply a primop to two actual integers

Algebraic matching

data AltMatch alt Source #

Successful alternative match, used for finding the right branch in case

data AltError Source #

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