List
methods each
and fold
. The former takes a single argument function and calls it on each element of the list, while the latter takes a two-argument function which is used to combine all the elements:A
and returning a B
is A -> B
. It's easy to remember when you think about the arrow as representing a transformation from type A
to type B
.Real
, an Int
and returning a Text
would be typed as Real -> Int -> Text
. The last part of such an arrow chain is the return value, while all the parts before are consecutive arguments.add1
node does not set any arguments, thus the output type is Int -> Int -> Int
,add2
node has the second argument connected, so the output type is Int -> Int
. Note the _
in it's expression. This underscore introduces explicit currying for this argument – add _ number1
means "set the second argument and leave the first one unapplied",add3
node applies the first argument and leaves the second one. There is no need for the _
in this case, since the applied argument precedes the unapplied. The type is the same as that of add2
, since both arguments have the same type.add4
node is fully applied, so the return type is just Int
.