Giter Site home page Giter Site logo

emattfolk / purescript-vexceptt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jordanmartinez/purescript-vexceptt

0.0 1.0 0.0 12 KB

A version of `ExceptT` that uses `Veither`, an extensible `Either`.

License: MIT License

PureScript 87.18% Dhall 12.82%

purescript-vexceptt's Introduction

purescript-VexceptT

A version of ExceptT that uses Veither instead of Either.

Inspired by and only slightly different in definition from ExceptV. However, VexceptT fully reimplements all API of ExceptT except for these type classes:

  • Alt
  • Plus
  • Alternative
  • MonadPlus

ExceptV vs VexceptT

-- # Main types compared
newtype ExceptV  e m a = ExceptV (m (Either (Variant e) a))
newtype VexceptT e m a = ExceptV (m (Veither         e  a))

-- # Underlying types compared
data Either l r 
    = Left l 
    | Right r

newtype Veither e r = Veither (Variant ("_" :: a | e))

-- pseudo-code
type Variant ("_" :: a) = {type: "_", value: a }

-- # Comparing how errors are stored at runtim
ExceptV  (pure (Left    (inj _sym error))) :: ExceptV  e m a
VexceptT (pure (Veither (inj _sym error))  :: VexceptT e m a

-- Dropping the `Either` removes one layer of boxing at runtime
pure (Left {type: "error", value: e})) :: ExceptV  e m a
pure (     {type: "error", value: e})  :: VexceptT e m a

-- # Comparing how success value are stored at runtime
ExceptV  (pure (Right                 a)  :: ExceptV  e m a
VexceptT (pure (Veither (inj _sym error)) :: VexceptT e m a

-- Unsure whether `Right a` is more performant than `{type: "_", value: a}`
pure (Right              a)) :: ExceptV  e m a
pure ({type: "_", value: a}) :: VexceptT e m a

purescript-vexceptt's People

Contributors

jordanmartinez avatar emattfolk avatar

Watchers

 avatar

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.