This week I was reading this article from @rrrene on the use of
|> for control flow. I enjoyed the article and many of the points it made. In my opinion with is not the best for error handling, although it is great for several other composition usecases.
It got me thinking about how I use a library I have written called
The quick summary is that OK provides helpers for composition but explicitly for the cases when errors are being handled. First is
OK.try which is similar to
with but strictly for working with
:error tuples. Second is
~>> which replaces
|>. Again its use is strictly for handling result tuples.
See the README for more info.
This library is now regularly receiving more than 100 downloads per day and some of you must be among those.
I am interested in hearing about people have been using of this library.
- Do you find it easy to add to existing code or does it force you to change your code?
- Is that change beneficial?
- Do you care that understanding monads influenced the design?
I find it has forced me to change my code, and I find that in most cases that is beneficial.
However as much as I like the pipeline
~>> approach I most real world situations I have found that too constraining and for 90%+ uses I reach for the other tools in the library.