Add Try type to Fugue

Issue #57 resolved
Gene Taylor created an issue

Is there interest in adding Try type to Fugue similar to that which is found in Scala i.e this.

I am happy to do the work but thought it was worth checking if there was interest before starting.

Comments (7)

  1. Anund McKague

    Can you expand on you're implementation goals? Some care needs be taken to figure out if you can properly obey the monad laws or not. The Scala implementation chooses not to in certain circumstances and I cannot remember if you can avoid that given your own implementation. Some initial googling on the original problem to help recover some of the original discussions: https://gist.github.com/ms-tg/6222775, http://stackoverflow.com/questions/29716205/is-it-try-a-monad-if-unit-success

    Following that; Try[+A] being similar to Either[Exception, +A] suggests it would be helpful to compare the list of operations Either supports that Try does not and vice versa. That would help find the extra helper methods you want to add and which old methods you may want to remove. It may also inform the actual implementation.

  2. Gene Taylor reporter

    The high level goal is to implement something slightly friendlier than either to represent the result of an operation that can potentially fail as I have found some people find Either used this was as unintuitive.

    So I will go away and have a think about what a potential API could look like and if we can make it obey the monadic laws. I will come back with a sketch of an API once I have something.

  3. Gene Taylor reporter

    Add an initial implimentation of Try

    A safety first implemetnation of Try has been added, it will automatically catch an wrap an exceptions throw by the provided function in map etc with a Failure. See issue #57 for further information.

    → <<cset e2b1622af276>>

  4. Gene Taylor reporter

    Add an initial implimentation of Try

    A safety first implemetnation of Try has been added, it will automatically catch an wrap an exceptions throw by the provided function in map etc with a Failure. See issue #57 for further information.

    → <<cset 55cc87a30616>>

  5. Gene Taylor reporter

    Add an initial implimentation of Try

    A safety first implemetnation of Try has been added, it will automatically catch an wrap an exceptions throw by the provided function in map etc with a Failure. See issue #57 for further information.

    → <<cset 55cc87a30616>>

  6. Log in to comment