Haskell: do
Scala: for
OCaml: let*
F#: let!
Elixir: with
What other monadic syntaxes and keywords are there?
Conversation
I’m partial to `let x <- e1; e2`
1
3
I was considering that but wasn't sure if it would be confusing to reuse `let`
1
1
Yeah not sure. I think Conor McBride argues that do notation was a bit of a mistake, but can’t remember his reasons 🤔
2
1
There’s an issue I think that it often encourages sequential computation unnecessarily? A bit like async/await.
1
3
This is kind of where applicatives come in I think. I believe OCaml has `let+` for applicatives?
2
2
Yeah I'm actually more interested in the syntax than monads here. I think there's a bunch of value in being more flexible
1
2
Replying to
Ah cool. I think there is an argument for: why have syntax at all? If it’s in the types, let the elaborator figure it out.
Replying to
To make this flat, among other things.
one()
|> promise.then(fn (x) {
two()
|> promise.then(fn (y) {
three()
|> promise.then(fn (z) {
promise.resolve(x + y + z)
})
})
})
1
Yeah, you could imagine elaborating let expressions to that, based on the types. Haven’t thought about all the details and issues surrounding that however.
1
Show replies

