
On Fri, Apr 11, 2014 at 12:28 AM, Jason Dagit
It seems to be an issue with giving everything on a single line:
Prelude λ> let whee x = x == x && null (show x) :: Show a => Eq a => a => Bool
<interactive>:2:14: Couldn't match expected type `a -> Bool' with actual type `Bool' In the expression: x == x && null (show x) :: Show a => Eq a => a => Bool In an equation for `whee': whee x = x == x && null (show x) :: Show a => Eq a => a => Bool
As the error message indicates, the (:: type) is being applied to the open term: x == x && null (show x), and not to the function whee. To do this single-line def properly, I think you need -XScopedTypeVariables: let whee (x :: a) = x == x && null (show x) :: Show a => Eq a => Bool
I see now to make it work as a one liner I could do it this way: Prelude λ> :t (\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool (\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool :: (Eq a, Show a) => a -> Bool
And to recover the named binding: let whee = (\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool -- Kim-Ee