A lot of the std lib uses Result(a, Nil) in places (for example Dict.get) where other languages would use Maybe. I had always thought of the rule of thumb being
- representing the presence or absence of something, use
Maybe. (e.g. the list may or may not have a first item, a dict/map may or may not have some value for a given key) - representing something that could error or otherwise fail, use
Result, (e.g making an HTTP request, writing a file)
This doesn't really seem to apply to what I see in the std lib. What's the criteria you use to decide when to use o Option vs Result(a, Nil) ? Is there a similar idiomatic rule of thumb?