Hacker News new | past | comments | ask | show | jobs | submit login

> I'm reading it as 'Container' passed 'r' and 'a' performs 'a' to 'r' which returns 'r'. (I'm guessing on verbs here).

This is an equation; it's a relating/defining one thing in terms of other things. In particular, there's no concept of "performing" (e.g. there's no time, state, etc. here)

In this case "Cont" is just a name; we can tell that, since the equation tells us that "Cont r a" is equal to some other thing involving "r" and "a", so we could just as well use that other thing (that's what it means for two things to be equal!). Hence, "Cont r a" is just a shorthand for "(a -> r) -> r".

So what is "(a -> r) -> r"? In general, for any types "x" and "y", the type "x -> y" is the type of functions which take an "x" as input and return a "y".

So "a -> r" is a function which takes an "a" and returns an "r".

So "(a -> r) -> r" is a function which takes a function from "a" to "r", and returns an "r".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: