Promise.cast and Promise.resolve

Forrest L Norvell forrest at
Tue Jan 28 16:03:26 PST 2014

In Haskell, 'flatMap' is the operation on applicative functors that
corresponds to the 'bind' operation on monads. Monads were introduced to
Haskell to provide a mechanism for doing effectful programming that
restricted the areas of danger around I/O, and the reification of the
underlying category theory in which monads are a specialization of
applicative functors only came later. Rationalizing all of that would
require breaking backwards compatibility of most Haskell code that depends
on the standard library. Scala wasn't stuck with this legacy, so they kept
the more general term for the operation.

'chain' is a fine name, especially because "monadic promises" work fine in
a language with type systems, but the JS version, when / if it comes, is
only going to be a distantly rhyming version of a monad, for reasons that
we've gone over to death in the past. JS should give names to operations
that will actually give people a clue to their purpose.


On Tue, Jan 28, 2014 at 3:48 PM, Brendan Eich <brendan at> wrote:

> Andreas Rossberg wrote:
>> On 29 January 2014 00:30, Brendan Eich<brendan at>  wrote:
>>> >  Andreas Rossberg wrote:
>>>> >>>
>>>>> >>>  `flatMap`
>>>>> >>>  ...
>>>> >>
>>>> >>
>>>> >>  The V8 implementation provides it under the name `chain', with the
>>>> >>  obvious semantics.
>>> >
>>> >  +1 on chain as name, not flatMap, but Haskell'ers should weigh in.
>>> Wait, no.
>>> >  :-P
>> Well, Haskell does not have flatMap. Scala has.
> What's all this then?
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list