4 ms·
That was a nice article, however with a few caveats: - I don't understand why you would use either, composed of left and right; where you could use result, com
by Zababa 5y ago
That was a nice article, however with a few caveats:
- I don't understand why you would use either, composed of left and right; where you could use result, composed of ok and err, which would be closer to regular Elixir.
- There's no mention of typechecking at all.
- ReleaseCandidat 5y ago> I don't understand why you would use either, composed of left and right; Because Haskell uses `Either err a = Left err | Right a`
- Zababa 5y agoThat sounds like a situation where you copy what other people do without a good reason to do so.
- ReleaseCandidat 5y agoYes, exactly.
- aroccoli 5y agoIt's historically like that in Haskell, and that's how the library defines it. I agree that Result is much clearer, and would love to use it here. But then I would also have to go through how to use Algae to define the type instead of using it out of the box, which would make the article longer. Similarly with typechecking -- Elixir is dynamically typed, not everyone uses dialyxir, and to bring that whole story inside would also complicate the article. I plan to continue exploring this space, and perhaps I will slowly understand how to best introduce these ideas to Elixir people correctly, but right now I am just trying to approach it from different kinds of angles. Thank you for the comments. :) -- Author
- Zababa 5y agoThanks for the explanations, that makes sense. It's a bit sad that Algae used the same convention as Haskell instead of going with something clearer.