Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Result #13

Merged
merged 2 commits into from
Jun 30, 2020
Merged

Result #13

merged 2 commits into from
Jun 30, 2020

Conversation

JamieB-gu
Copy link
Contributor

What does this change?

Added an Result type and companion functions. This PR relies on #12 and is also a clone of the type that we've been using for some time in apps-rendering. I'm migrating it to this repo because I'd like to make use of it in liveblog-rendering as well, and it may be useful for DCR if and when it starts to consume liveblog-rendering.

Changes

  • New Result type, consisting of Ok and Err
  • fromUnsafe constructor to create a Result from a possible JavaScript exception
  • ok and err convenience functions to create a Result
  • either, map, mapError, partition and andThen functions for working with Result
  • toOption function to convert a Result to an Option

Copy link

@alexduf alexduf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as: #12 (comment)

The code certainly look good, but how does the DCR team feel about that style of programming?

Base automatically changed from option to master June 30, 2020 15:35
@JamieB-gu JamieB-gu merged commit ece950b into master Jun 30, 2020
@JamieB-gu JamieB-gu deleted the result branch June 30, 2020 15:40
@JamieB-gu
Copy link
Contributor Author

how does the DCR team feel about that style of programming

Fair question, see my comment on the other PR for reference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants