composeList
Emre Tezel
emre.tezel@verizon.net
Sun, 12 May 2002 19:19:40 -0400
Hi all,
I recently bought Simon Thompson's Haskell book. I have been doing the
exercises while I read on. There are couple questions that I can not
solve. Any help would be greatly appreciated.
I got stuck on this question in Chapter 10.
Define a function composeList which composes a list of functions into a
single function. What is the type of composeList?
I naively tried the following but the hugs compiler complained about the
inferred type not being generic enough.
composeList :: [(a -> b)] -> (c -> b)
composeList [] = id
composeList (x:xs) = x . (composeList xs)
or
composeList :: [(a -> b)] -> (c -> b)
composeList (x:xs) = x . (composeList xs)
ERROR "Chapter10.hs":6 - Inferred type is not general enough
*** Expression : composeList
*** Expected type : [a -> b] -> c -> b
*** Inferred type : [a -> a] -> b -> a
Anybody can solve this?
Emre