stdlib
stdlib copied to clipboard
Refactored list and dict to use Option type instead of Result for better ergonomics.
trafficstars
This PR will update the standard library from using Result to using Optional
Why?
I found many of the list functions using Result were returning Error(Nil) or ignoring the user's passed error type.
Error(a) to me represents an unexpected outcome. Similar to a raise or throw in another language. Where we can then supply the developer inside with it's a value.
Filtering through a list, to not find the item, is not error worthy. The outcome is expected. Therefore, None is better, and at the same time we don't lose any data being returned to the developer. Since all of the previous implementations just returned Error(Nil) or ignored the a in Error(a) anyway.