1

Topic: JavaScript and Haskell: and monads

Here I read a book on JavaScript. Also it seems to me that  new Promise (...).then (...).then (...).then (...) method Promise.prototype.then - on>> = (i.e.  bind) in this Haskelle is very similar to the do-block in Haskelle, and. To me , or I guessed? Whether it is possible to write in Haskelle analog  with usage of monads?

2

Re: JavaScript and Haskell: and monads

MSS> Here I read a book on JavaScript. MSS> Also it seems to me that  new Promise (...).then (...).then (...).then (...) method Promise.prototype.then - on>> = (i.e.  bind) in this Haskelle is very similar to the do-block in Haskelle, and. MSS> To me , or I guessed? Whether MSS> it is possible to write in Haskelle analog  with usage of monads? Similar on that (I the artificial welder, used only Workers' and Peasants' IO)

3

Re: JavaScript and Haskell: and monads

Hello, Maxim S. Shatskih, you wrote: MSS> Here I read a book on JavaScript. MSS> Also it seems to me that  new Promise (...).then (...).then (...).then (...) method Promise.prototype.then - on>> = (i.e.  bind) in this Haskelle is very similar to the do-block in Haskelle, and. MSS> To me , or I guessed? Whether MSS> it is possible to write in Haskelle analog  with usage of monads? The function signature result! Not all who knows Haskell, know JavaScript. For example, I did not write 100 years on the last. And so, monads is a so general property that is a lot of where they meet. The title not so successful, not pop, too pseudoscientific is simple, and presently it is not appreciated.

4

Re: JavaScript and Haskell: and monads

D> the function Signature result! Here

5

Re: JavaScript and Haskell: and monads

Hello, koenig, you wrote: D>> the function Signature result! K> here at least the approximate description of types. Where that is returned. So,  that return?  or it is simple void?

6

Re: JavaScript and Haskell: and monads

But I think that anyway it should be very similar to monad Cont from Haskell, monad Async from F# and monad Future from Scala

7

Re: JavaScript and Haskell: and monads

And on monad Future from Rust too!

8

Re: JavaScript and Haskell: and monads

D> And on monad Future from Rust too! About, here the person got. This knowledge has been acquired on operation?

9

Re: JavaScript and Haskell: and monads

Hello, koenig, you wrote: D>> And on monad Future from Rust too! K> about, here the person got. This knowledge has been acquired on operation? No, at leisure. There function and_then also is  a sheaf. Whether is return, it is necessary to look, but I think, it can be drawn. So that,  it is accepted to name a sheaf flat_map as for the same iterators in Rust, but here in futures-rs for some reason here so named more. For an example in Scala  the sheaf too flatMap is called, and here in F# as Bind. Well, and in Haskell it cipher as (>> smile as some know

10

Re: JavaScript and Haskell: and monads

Hello, koenig, I opened not so long ago for myself Rust. Simply surprising language! And without a garbage collector. Thus allows to express such high-level things as monads. Amazingly! Anything similar anywhere any more did not see.

11

Re: JavaScript and Haskell: and monads

D> the function Signature result! Not all who knows Haskell, know JavaScript. For example, I did not write 100 years on the last. Presently JavaScript became high-grade functional language. Only lazy eval like as is not present.

12

Re: JavaScript and Haskell: and monads

D> And so, monads is a so general property that is a lot of where they meet. The title not so successful, not pop, too pseudoscientific is simple, and presently it is not appreciated. Quite pop, simply beginning difficult happens to understand, what practical tasks are convenient for solving with their help.

13

Re: JavaScript and Haskell: and monads

D> At least the approximate description of types. Where that is returned. So,  that return?  or it is simple void? We have: new Promise (InitPath).then (Lambda1).then (Lambda2) Lambdas with one parameter also return 1 value - or , or not-promis. If Lambda1 returns not-promis it turns out Lambda2 (Lambda1 (ResolveObjectOfFirstPromise)) after end of the first . I.e. reset from 1 becomes parameter 2. And here if Lambda1 returns  SecondPromise then Lambda2 it will be called only on end SecondPromise with its parameter of end. I do not know, how it is made at engine level, I know only that all these lambdas are called only in a cycle of idle time of the interpreter - i.e. rush in queue and then understand from it. I can assume that then creates new  and puts it as "child" for initiating  (the this). And further end  if it returned not-promis, completes the child. If returned  very much can be that child it is killed, and its contents (a lambda and the link on its child) are shifted in SecondPromise.

14

Re: JavaScript and Haskell: and monads

Hello, Maxim S. Shatskih, you wrote: D>> At least the approximate description of types. Where that is returned. So,  that return?  or it is simple void? MSS> It is had: MSS> new Promise (InitPath) MSS>.then (Lambda1) MSS>.then (Lambda2) MSS> Lambdas with one parameter also return 1 value - or , or not-promis. Here when returns  the sheaf works as normal . Well, and if returns not-promis it is more similar that continuation returns not normal , and what would turn out after function application return. To all signs a monad though the interface is a bit the non-standard.

15

Re: JavaScript and Haskell: and monads

Hello, Maxim S. Shatskih, you wrote: MSS> Here I read a book on JavaScript. MSS> Also it seems to me that  new Promise (...).then (...).then (...).then (...) method Promise.prototype.then - on>> = (i.e.  bind) in this Haskelle is very similar to the do-block in Haskelle, and. MSS> To me , or I guessed? Whether MSS> it is possible to write in Haskelle analog  with usage of monads? It only one specific monad - continuation. Monads different great variety.