David Carter wrote:
This is all as I would expect so far, but:

Prelude> let sqlist = map sq
Prelude> :t sqlist
sqlist :: [Integer] -> [Integer]

And indeed, I get

Prelude> sqlist [2.5]

<interactive>:1:8:
   No instance for (Fractional Integer)
   ... etc

The dreaded Monomorphism Restriction, which GHCi chooses to apply after every line you input. You could say "let sqlist a = map sq a" (syntactically having arguments makes the defaulting of (Num a => [a] -> [a]) not apply), or just use `ghci -fno-monomorphism-restriction`.

Isaac
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to