Last active
December 16, 2015 20:10
-
-
Save 5outh/5490739 to your computer and use it in GitHub Desktop.
Expr type
This file contains hidden or 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
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