diff options
| author | Raymond Hogenson <rhogenson@posteo.net> | 2018-05-18 12:01:22 -0800 |
|---|---|---|
| committer | Raymond Hogenson <rhogenson@posteo.net> | 2018-05-18 12:01:22 -0800 |
| commit | fb1f8d3a02908e2fe8c08924c2eacef6b84a7204 (patch) | |
| tree | b128b705019448c44b84c0cc3e0cb65010cb5c71 /Expr.hs | |
| parent | Add license information to the top of the files (diff) | |
| download | hsc-fb1f8d3a02908e2fe8c08924c2eacef6b84a7204.tar.zst | |
Support exponentiation
Haskell might make this overcomplicated, but it's a complicated problem
to solve, I suppose. Whatever. It works well.
Diffstat (limited to 'Expr.hs')
| -rw-r--r-- | Expr.hs | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -30,6 +30,7 @@ data Expr = Plus Expr Expr | Minus Expr Expr | Times Expr Expr | Div Expr Expr + | Pow Expr Expr | EInt Integer | EFloat Double | E @@ -66,6 +67,7 @@ prefix name fun = Prefix (fun <$ tokenS name) table :: [[Operator String u Data.Functor.Identity.Identity Expr]] table = [ [ prefix "log" Log, prefix "sin" Sin, prefix "cos" Cos, prefix "sqrt" Sqrt ] , [ prefix "-" Negate ] + , [ binary "^" Pow AssocLeft ] , [ binary "*" Times AssocLeft , binary "/" Div AssocLeft ] |
