Ketil Z. Malde
05 May 2003 14:28:09 +0200
sashan <email@example.com> writes:
> When compiled with ghc I get the following error:
> No instance for (Num String)
> arising from the pattern `2' at test.hs:8
> In a case alternative: 2 -> do putStrLn "f2"
> In the case expression:
> case choice of
> 1 -> do putStrLn "f1"
> 2 -> do putStrLn "f2"
> _ -> do putStrLn ""
> Please can someone explain.
The compiler already did: No instance for (Num String)
In other words, a String is not a Num(ber), and you are treating it as
one (the variable 'choice' in the case clause).
If I haven't seen further, it is by standing in the footprints of giants