[Haskell-cafe] Deducing a type signature

Richard O'Keefe ok at cs.otago.ac.nz
Wed May 19 19:09:41 EDT 2010


On May 20, 2010, at 11:03 AM, R J wrote:

> stranger f = f f
>

This doesn't have a type in Haskell.
Suppose f :: a -> b
Then if f f made sense, a = (a -> b) would be true,
and we'd have an infinite type.

Type the definition into a file, and try loading it
into ghci:

     Occurs check: cannot construct the infinite type: t = t -> t1
     Probable cause: `f' is applied to too many arguments
     In the expression: f f
     In the definition of `stranger': stranger f = f f



More information about the Haskell-Cafe mailing list