diff options
-rw-r--r-- | readme.txt | 8 | ||||
-rw-r--r-- | src/Operators.hs | 4 |
2 files changed, 9 insertions, 3 deletions
@@ -18,9 +18,11 @@ cabal: | |||
18 | 18 | ||
19 | cabal run | 19 | cabal run |
20 | 20 | ||
21 | |||
21 | todo | 22 | todo |
22 | ---- | 23 | ---- |
23 | 24 | ||
24 | * use Control.Monad.Except from mtl to handle errors | 25 | * implement correct double/int interaction (src/Operators.hs) |
25 | * implement property based testing with quickcheck, look | 26 | * implement boolean operations: and, not, or |
26 | under tests/Properties.hs | 27 | * write Ord instance for LispNumber (src/Operators.hs) |
28 | * implement property based testing with quickcheck (tests/Properties.hs) | ||
diff --git a/src/Operators.hs b/src/Operators.hs index 9eaec38..fc0608e 100644 --- a/src/Operators.hs +++ b/src/Operators.hs | |||
@@ -19,6 +19,10 @@ data LispNumber = I Integer | |||
19 | | F Double | 19 | | F Double |
20 | 20 | ||
21 | instance Num LispNumber where | 21 | instance Num LispNumber where |
22 | -- TODO: | ||
23 | -- float op anything = float | ||
24 | -- int op int = int | ||
25 | -- int op float = float | ||
22 | (I a) + (I b) = I $ a + b | 26 | (I a) + (I b) = I $ a + b |
23 | (F a) + (F b) = F $ a + b | 27 | (F a) + (F b) = F $ a + b |
24 | (I a) - (I b) = I $ a - b | 28 | (I a) - (I b) = I $ a - b |