Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active February 13, 2017 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/391cd070c90ade0d606c5adb963f4da4 to your computer and use it in GitHub Desktop.
Save deque-blog/391cd070c90ade0d606c5adb963f4da4 to your computer and use it in GitHub Desktop.
type Id = String -- Variable identifier
type Env = -- Environment of evaluation
Map Id Int
data OpType -- Types of operations
= Add -- * Addition
| Mul -- * Multiplication
deriving (Show, Eq, Ord)
data ExprR r -- Open recursive expression type
= Cst Int -- * Constant
| Var Id -- * Variable
| Op OpType [r] -- * Operation
deriving (Show, Eq, Ord)
-- The type of arithmetic DSL (fixed point of ExprR)
type Expr = Fix ExprR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment