DEV Community

Discussion on: Do you consider learning Elm?

 
mateiadrielrafael profile image
Matei Adriel

Whoa whoa whoa, since when does do-notation look like imperative code, it's just syntactic sugar for working with monads

I also brought up computational expression, take async/await, a lot of languages have it now (c#, js, rust, py etc) but it came from the async workflow f# had to offer

Thread Thread
 
macsikora profile image
Pragmatic Maciej

It looks like it or at least simulates motion of simple effectfull step by step instructions. In the same way async/await looks like synchronous code. There is a reason for both - it's just more handy and readable. It's syntactic sugar exactly that is why it's not just have.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

Do-notation isnt effectful code only, it can work with any monad, the same way you can call .bind on an Io/Eff by hand

Thread Thread
 
macsikora profile image
Pragmatic Maciej • Edited

I didn't say it is related only to IO. But for such it looks like one. I am not against do notation I am also not stating it's wrong, I am just saying it's not must to have and being only suger can be added to Elm in any moment.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

How can sintactic sugar for monads be addable to elm when elm doesnt even support typeclasses?

Thread Thread
 
macsikora profile image
Pragmatic Maciej

That would be a problem. But we could be having some do notation for specific Monads, like async await is for continuations.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

But then we would need something like computstional expressions to use user defined notations