Closed texastoland closed 8 years ago
I'll just drop a reference to Elm's Result
as an additional source of inspiration http://package.elm-lang.org/packages/elm-lang/core/2.1.0/Result
Although, it has nothing to do with exceptions and thunks, only the friendlier naming.
Here's my F# version, for reference: https://github.com/functionauts/Result
@zudov Yeah Elm uses Result
as an alias for Either
. Likewise formatError
looks like lmap
. to
/fromMaybe
would be nice though! Ultimately we want an alternate prelude with beginner friendly naming too. But referencing a couple Swift implementations I noticed they took it a step further to encapsulate error handling.
@paulyoung Thanks! Very succinct and reassuring this is low hanging fruit. What's the use case for dematerialize
?
@AppShipIt it's equivalent to dematerialize
in antitypical/Result but I only really added it for interop with C# where an exception is expected to be thrown.
Totally missed that thanks! May as well add for parity.
This seems like something which belongs in a user library, but not necessarily the core libraries. Automatic handling of exceptions is not the sort of "opinionated" (if you like) approach taken by core libraries.
Sent from my iPhone
On Feb 22, 2016, at 7:50 AM, Texas Toland notifications@github.com wrote:
Totally missed that thanks!
— Reply to this email directly or view it on GitHub.
Ah didn't realize it was necessarily for core stuff (likewise #45). I opened the issue as a personal todo unless someone else wants to. Clarify opinionated?
My idea was vaguely motivated by Harry's Eff
functions. I just want to be able to consume an exception-al JS thing and not crash PS.
Better implemented as an extension to Either
with the Result
nomenclature in Preface eventually. Closing as more of a community effort than necessarily official for the time being.
Conveniences for handling JavaScript exceptions and Node thunks. Inspired by Result from the Swift community. Originally suggested by @archaeron in paf31/purescript-preface#1.