Types and Functions 2: Currying

It goes wrong fairly quickly when it comes to Chapter 04: Currying. It is unclear why you would want to do this1 and how the code really works.

An additional problem is that many function definitions after this are written in curried form, like so:

// join :: String -> [String] -> String

It would have been nice if it was mentioned how to read these. To be fair it is in a way in the same Chapter 07 where I found the above signature: “Without fully understanding the details, you could always just view the last type as the return value.”

Digging through a bunch of mostly unhelpful documents, I figured out that you can take everything around the arrows as function arguments except for the last one.

So the join above is a function that takes a String and an array of Strings and returns a String.

Addendum: This also makes it easier to read the Ramda type signatures.

  1. I suspect that that will be a recurring theme.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.