Hey Haskell-Cafe,

I was trying out the code in Dons's article [1], and I noticed a weird thing when doing it in GHCi. When binding the function composition to a variable, the type suddenly changes. I'm not completely sure why this happens. Is this because GHCi is in a monad and wants to find an instance for the type variable? Here's my GHCi session:

Prelude> :m +Control.Arrow
Prelude Control.Arrow> :m + List
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)]

Thanks,
-chris

[1]: http://cgi.cse.unsw.edu.au/~dons/blog/2007/07/31
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to