Skip to content

New Try monad and updated TryT transformer

Pre-release
Pre-release
Compare
Choose a tag to compare
@louthy louthy released this 16 May 14:36

I've re-added a Try<A> monad (I always intended to re-add it, just hadn't got around to it). And I've and reimplemented the TryT<M, A> monad-transformer in terms of Try (K<M, Try<A>>), previously it was implemented in terms of Fin (Func<K<M, Fin<A>>>).

I have also:

  • Added Match and IfFail methods for pattern matching on the success/fail state.
  • Added | operator @catch overrides to allow for easy error handling.

The IO monad also has a .Try() method that will run the IO monad in a try/catch block returning IO<Fin<A>> for more manual handling of IO errors.

Still needs some in-depth testing to make sure all exceptions are captured, but it's effectively feature complete.