
On Jul 31, 2007, at 6:00 , apfelmus wrote:
Chris Eidhof wrote:
When binding the function composition to a variable, the type suddenly changes.
Prelude Control.Arrow List> :t map (length &&& head) . group map (length &&& head) . group :: (Eq a) => [a] -> [(Int, a)] Prelude Control.Arrow List> let encode = map (length &&& head) . group Prelude Control.Arrow List> :t encode encode :: [Integer] -> [(Int, Integer)]
In short, you have to supply a type signature
encode :: (Eq a) => [a] -> [(Int, a)] encode = map (length &&& head) . group
let encode :: (Eq a) => [a] -> [(Int,a)]; encode = map (length &&&
Note that you can do this at the GHCi prompt like this: head) . group since you can't use multi-line declarations from the prompt. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH