Skip to content

Instantly share code, notes, and snippets.

@mchakravarty
Created August 25, 2013 05:20
Show Gist options
  • Save mchakravarty/6332159 to your computer and use it in GitHub Desktop.
Save mchakravarty/6332159 to your computer and use it in GitHub Desktop.
Functorial approach to defining expressions.
data PreExp exp = Val Int
| Add exp exp
newtype Exp = Exp (PreExp Exp) -- this is just a normal expression
data AttrExp = AttrExp Attr (PreExp AttrExp) -- an attributed expression
data Attr = ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment