The following type of program checks if I specify on the command line (for example, ghci file.hs):
import Data.Ratio
foo = let x = [1..]
y = (1%2) + (head x)
in y
However, if I enter it interactively, I get an error like:
Prelude> import Data.Ratio
Prelude Data.Ratio> let x = [1..]
Prelude Data.Ratio> let y = (1%2) + (head x)
<interactive>:1:23:
Couldn't match expected type `Ratio a0' with actual type `Integer'
It seems xto be impatiently printed as [Integer]opposed to the more general (Num t, Enum t) => [t].
Is there anything I can do about it? Are there other situations where the interactive mode will be different from the batch?
Erikr source
share