GHC Bug or User Error?

Zachary Turner divisortheory at
Sun Dec 6 23:57:58 EST 2009

GHCi, version 6.10.4:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> let f x = x*x
Prelude> let g x y = x+y
Prelude> let q x y = (f . g) x y
Prelude> :t q
q :: (Num (a -> a), Num a) => a -> a -> a

I'm somewhat of a beginner so the error could definitely be my own, but it
seems to me like the third line should be rejected by GHCi.  As for the 4th
line, the type of q seems nonsensical to me.  I can't figure out any
possible valid meaning of 'Num (a -> a) '.

Can anyone shed some light on this?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list