5 ms·
Is there an equivalent of the Haskell Either monad & do-notation / Rust Result + the ? (try) operator?
by cormacrelf 5y ago
Is there an equivalent of the Haskell Either monad & do-notation / Rust Result + the ? (try) operator?
- mcintyre1994 5y agoSort of, there’s a convention used throughout the standard library of returning {:ok, output} or {:err, error} or nil. That makes it really easy to compose functions/check for errors. The equivalent of do-notation would be with statements I think: https://elixirschool.com/en/lessons/basics/control-structures/#with https://elixirschool.com/en/lessons/basics/control-structure...
- cormacrelf 5y agoohhhhhhhhh, with statements do sequential . Yep. I'm on board with the original post now. Thanks!