[Haskell-cafe] Deducing a type signature

2010-05-19 Thread R J
Bird 1.6.3 requires deducing type signatures for the functions strange and stranger. Are my solutions below correct? (i) strange f g = g (f g) Assume g :: a - b. Then f :: (a - b) - c. But since g :: a - b,f g :: a, so c = a. Therefore, f :: (a - b) - a, and g (f g) :: a.Therefore, strange

Re: [Haskell-cafe] Deducing a type signature

2010-05-19 Thread Richard O'Keefe
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

Re: [Haskell-cafe] Deducing a type signature

2010-05-19 Thread Dan Weston
(i) strange f g = g (f g) Assume g :: a - b. Then f :: (a - b) - c. But since g :: a - b, f g :: a, so c = a. Therefore, f :: (a - b) - a, and g (f g) :: a. Therefore, strange :: ((a - b) - a) - (a - b) - a. Almost. The return type of strange is the same as the return type of g (the