Last active
February 13, 2017 18:31
-
-
Save deque-blog/391cd070c90ade0d606c5adb963f4da4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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