
Bird problem 1.6.2 is: If f :: (a, b) -> c, then define a function "swap" such that: flip (curry f) = curry (f . swap). I'd very much appreciate if someone could tell me whether there's a rigorous solution simpler than mine, which is: Since (.) :: (q -> r) -> (p -> q) -> (p -> r), we have f :: q -> r and swap :: p -> q. Type unification of f requires q = (a, b) and r = c. Since f :: (a, b) -> c and curry :: ((l, m) -> n) -> (l -> m -> n), typeunification requires l = a, b = m, and n = c. Therefore,curry :: ((a, b) -> c) -> (a -> b -> c), and (curry f) :: a -> b -> c. Since flip :: (s -> t -> u) -> t -> s -> u, type unification requiress = a, t = b, and u = c. Therefore, flip :: (a -> b -> c) -> b -> a -> c,and flip (curry f) :: b -> a -> c. Therefore, curry (f . swap) :: b -> a -> c, and p :: b -> a. Therefore,swap :: b -> a -> (a, b), and: swap :: b -> a -> (a, b)swap x y = (y, x) _________________________________________________________________ Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:W...