I got an itch last Wednesday to try out an Either
-less version of ExceptV
from purescript-checked-exceptions
that directly uses Variant
the entire time rather than Either (Variant rows) a
.
While fumbling around with that idea, I realized it would be easier to write if I had an underlying version of Variant
that worked more like Either
. Well, a few days of tinkering later, we now have purescript-veither
, a Variant
version of Either
: https://github.com/JordanMartinez/purescript-veither
The Readme gives an idea for how it works. However, due to a bug with purs docs
, you’ll have to read the docs in the source code and/or look at its tests to see it in action.
In terms of performance, I’m not sure how this data type compares to using Either (Variant rows) a
due to the dictionary passing. But, it was fun to write.