
As I lay in bed last night, a curios fact occurred to me. (Yes, I don't get out very much...) Consider the map function: map :: (a -> b) -> [a] -> [b] There are two ways you can think about this function. First, you can see it as meaning map :: (a -> b) -> ([a] -> [b]) Which is beautifully symmetric. Alternatively, you can think about how you actually use it: map :: ((a -> b) -> [a]) -> [b] Now this got me thinking: is (->) associative? x_x Well now, let's consider a general 3-argument function: foo :: a -> b -> c -> d According to the rules, this is of course equivilent to foo :: a -> (b -> (c -> d)) If you understand what currying is and how it works, this makes perfect sense. Now let's bracket that the other way: foo :: ((a -> b) -> c) -> d Well, while that type *does* make sense, it's clearly a completely *different* type! So, clearly, (->) is not associative. Now I'm left wondering why you can bracket the type for map in two different ways, but not in general. Hmm...