I often see declarations such as this when viewing Haskell:
a -> (b -> c)
I understand that it describes a function that accepts something of type a and returns a new function that accepts something of type b and returns something of type c. I also understand that types are associative (change: I was wrong about this - see comments below), so the above could be rewritten in such a way as to get the same result:
(a -> b) -> c
This will describe a function that takes something of type a and something of type b and returns something of type c.
I also heard that you can make an addition (edit: indeed, the word I was looking for here is double - see comments below) to the function by switching arrows:
a <- b <- c
which, I think, is equivalent
c -> b -> a
but I'm not sure.
My question is: what is the name of this math? I would like to know more about this so that I can use it to help me write better programs. I'm interested in learning things like the function of a free function, and what other conversions can be performed in type declarations.
Thanks!
bmaddy
source share