Skip to content

Instantly share code, notes, and snippets.

@5outh
Last active December 16, 2015 20:10
Show Gist options
  • Save 5outh/5490739 to your computer and use it in GitHub Desktop.
Save 5outh/5490739 to your computer and use it in GitHub Desktop.
Expr type
infixl 4 :+:
infixl 5 :*:, :/:
infixr 6 :^:
data Expr a = Var Char
| Const a
| (Expr a) :+: (Expr a)
| (Expr a) :*: (Expr a)
| (Expr a) :^: (Expr a)
| (Expr a) :/: (Expr a)
deriving (Show, Eq)
sampleExpr :: Expr Double
sampleExpr = Const 3 :*: Var 'x' :^: Const 2 --3x^2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment