Hello,

Can someone elucidate to me this behaviour from ghci 6.6.1? Why is the type of sqlist specialised to Integer?

Prelude> let sq x = x * x
Prelude> :t sq
sq :: (Num a) => a -> a
Prelude> sq 2.5
6.25
Prelude> :t map sq
map sq :: (Num a) => [a] -> [a]
Prelude> map sq [2.5]
[6.25]

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

Thanks!

David





--
The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE. _______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to