3 ms·
I strongly suggest starting with a language like Elm to get into FP, since you start to use `map` and `andThen` quite often, but you also get sick of writing `a
by ghayes 5y ago
I strongly suggest starting with a language like Elm to get into FP, since you start to use `map` and `andThen` quite often, but you also get sick of writing `a |> Result.andThen fn1 |> Result.andThen fn2`. This can help a programmer realize why it might be better to have a concise syntax for this, like:
myFun : String -> Result String Int
myFun a =
do b <- fn1 a
c <- fn2 b
return c
That said, I think the other problem with Haskell is the definition of the bind operator: it is not obvious to a beginner which concrete function is actually being called for each monadic operation. Idris2, for instance, lets you specify the bind operator in its do notation[0].
[0] https://idris2.readthedocs.io/en/latest/tutorial/interfaces.html https://idris2.readthedocs.io/en/latest/tutorial/interfaces....