Split code into modules
Also did some work on laws
This commit is contained in:
parent
953c0d2298
commit
5113241a63
4 changed files with 88 additions and 43 deletions
22
Calculator.hs
Normal file
22
Calculator.hs
Normal file
|
@ -0,0 +1,22 @@
|
|||
module Calculator where
|
||||
|
||||
import Utils
|
||||
import Expr
|
||||
import Parser
|
||||
|
||||
data Law = Law LawName Equation
|
||||
deriving Show
|
||||
|
||||
type LawName = String
|
||||
type Equation = (Expr,Expr)
|
||||
|
||||
law :: Parser Law
|
||||
law = do name <- upto ':'
|
||||
eqn <- equation
|
||||
return (Law name eqn)
|
||||
|
||||
equation :: Parser Equation
|
||||
equation = do lh <- expr
|
||||
symbol "="
|
||||
rh <- expr
|
||||
return (lh, rh)
|
Loading…
Add table
Add a link
Reference in a new issue