Promise and map with JavaScript
Typically when we think of map we think of lists, but we can widen our thinking of map and through it get a simpler understanding of how the elusive JavaScript Promise works. the type signature of map Let’s take the ML notation for map of a list: ((a -> b) -> List a -> List b) With ML notation, the best way to read this is that the last arrow is the return type. The reason the notation exists this way is because functions in a functional language can be modeled as unary, or meaning they only have one argument. One can imagine multiple argument functions as sytactic sugar. ...