[Haskell-beginners] Type classes and synonyms

Philip Scott haskell-beginners at foo.me.uk
Sat Nov 21 15:33:28 EST 2009

Hi ho,

> In general, however, you just need practice.  Go code! =)

Righto, I am getting stuck in with that. One last question; I've been trying 
to read up on Arrows and my mind is being boggled. Via experiment, I have 
worked out what 'second' was doing (the documentation is useless unless you 
already understand a lot of stuff I clearly don't)

For the other newbies, 'second' takes a function and a tuple, it applies the 
function to the second thing in your tuple and returns a tuple with the first 
value unchanged, and the result of applying 'f' to the second:

>  second (\x -> "fish") (10,20)

What I am struggling to understand is what on earth the type signature means:

:t second
second :: (Arrow a) => a b c -> a (d, b) (d, c)

How can (\x -> "fish") be an 'a b c' when it really looks like this:

:t (\x->"fish")
(\x->"fish") :: t -> [Char]

And I am pretty sure I never made any Arrpws...

I feel I am on the verge of understanding something deep and fundamentally 
philosophical about the typesystem but I can't quite bend my mind around to it 

All the best,


More information about the Beginners mailing list