noether icon indicating copy to clipboard operation
noether copied to clipboard

Try.* functions

Open sphaso opened this issue 4 years ago • 0 comments

PR #29 highlighted how there's a set of functions from Scala\Haskell that we haven't considered. In particular Try.map from Scala acts as a functor on Try objects, applying a function in case no exception was thrown.
Currently we have Either.try which maps a function application to an either, i.e., :ok if the function succeeded, :error if an exception was thrown.

A few questions from the top of my head:

  • do we need Try.map when the user could use the with construct? (or just map after the Either.try)
  • are there other functions outside of Either.try that we could implement?
  • would it make sense to treat Try as a separate module (i.e. not piggybacking on either)?

@paolosimone @neslinesli93 @cottinisimone

sphaso avatar Sep 24 '20 09:09 sphaso