
29 Jan
2006
29 Jan
'06
3:54 p.m.
On Sat, 28 Jan 2006, Andrew Savige wrote:
Haskell beginner using GHC.
I have a function to do some simple arithmetic at run time:
myeval :: Int -> Int -> String -> Int myeval x y "+" = (+) x y myeval x y "-" = (-) x y myeval x y "*" = (*) x y -- ...
Additionally to the other suggestions, I advise using a custom type data Op = Add | Sub | Mul instead of String, if possible.