Git Product home page Git Product logo

Comments (2)

ploeh avatar ploeh commented on August 27, 2024

Yes, they're reversed. No, this is (unfortunately) not an error.

Languages (OCaml, F#) that call the type Result put the OK or Success case first (i.e. to the left) and the Error case second (i.e. to the right).

Languages (like Haskell) that call the type Either put the Left case first (because, well, that's to the left) and the Right case second (to the right). Inherently, Left and Right carry no additional semantics, but by convention (or, by pun), Right is used for those results that are... well, right (i.e. correct), which leaves the Left case for errors.

I usually follow that convention for both schools, which do, however, have the unfortunate power to confuse the careful reader.

FWIW, I usually favour the Either terminology, but there was a reason I adopted the Result terminology in the video. This is more evident if you watch the video, but basically, it's because I could explain how to arrive at the type gradually, via a series of refactorings from more specific Church-encoded types.

from ploeh.github.com.

TysonMN avatar TysonMN commented on August 27, 2024

Oh, no! Thanks for the clarification :)

from ploeh.github.com.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.