logo       

incorrect type error message: msg#00032

lang.haskell.glasgow.bugs

Subject: incorrect type error message

Consider

module Bug where

e = fmap id 1

ghci --version
The Glorious Glasgow Haskell Compilation System, version 5.02.2

says

:l Bug.hs
Compiling Bug ( Bug.hs, interpreted )

Bug.hs:5:
No instance for (Num (f a))
arising from the literal `1' at Bug.hs:5
In the second argument of `fmap', namely `1'
In the definition of `e': fmap id 1

Bug.hs:5:
Ambiguous type variable(s) `f' in the constraint `Functor f'
arising from use of `fmap' at Bug.hs:5
In the definition of `e': fmap id 1

although

:t (fmap id 1)
forall f a. (Num (f a), Functor f) => f a

Clearly, 'f' is not ambiguous.

Martin


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise