[Haskell-cafe] Deducing a type signature
R J
rj248842 at hotmail.com
Wed May 19 19:03:48 EDT 2010
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 :: ((a -> b) -> a) -> (a -> b) -> a.
(ii) stranger f = f f
Assume f :: a -> b. Since "f f" is well-typed, type unification requiresa = b. Therefore, f :: a -> a, and stranger :: (a -> a) -> a.
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100519/c2fb7f96/attachment.html
More information about the Haskell-Cafe
mailing list