The cool thing about Promises is that the then method, when used this way, is just like the map function. It has the same abstract type signature. This makes Promises behave like any other functor, which means that this method respects composition. Therefore,
I'm curious as to why you think it's better to "map once". I personally prefer using "then" repeatedly, because it might take a while for people who aren't familiar with functional programming to grab the concept of piping.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The cool thing about Promises is that the
then
method, when used this way, is just like themap
function. It has the same abstract type signature. This makes Promises behave like any otherfunctor
, which means that this method respects composition. Therefore,is the same thing as
Yes, I was thinking that as well. When chaining a sequence of maps, it's better to only map once using a composition of functions.
I'm curious as to why you think it's better to "map once". I personally prefer using "then" repeatedly, because it might take a while for people who aren't familiar with functional programming to grab the concept of piping.