How to "read" Elm's -> operator

Viewed 176

I'm really loving Elm, up to the point where I encounter a function I've never seen before and want to understand its inputs and outputs.

Take the declaration of foldl for example:

foldl : (a -> b -> b) -> b -> List a -> b

I look at this and can't help feeling as if there's a set of parentheses that I'm missing, or some other subtlety about the associativity of this operator (for which I can't find any explicit documentation). Perhaps it's just a matter of using the language more until I just get a "feel" for it, but I'd like to think there's a way to "read" this definition in English.

Looking at the example from the docs

foldl (::) [] [1,2,3] == [3,2,1]

I expect the function signature to read something like this:

Given a function that takes an a and a b and returns a b, an additional b, and a List, foldl returns a b.

Is that correct?

What advice can you give to someone like me who desperately wants inputs to be comma-delineated and inputs/outputs to be separated more clearly?

1 Answers
Related