Akh maybe monad and monad transformer
npm install akh.maybeThe MaybeT transformer, MaybeT, adds error control to a monad. The base type, Maybe, provides error logic on its own.
``bashTo use as standalone package
$ npm install --save akh.maybe
Usage
MaybeT and Maybe implement the [Fantasy Land][fl] monad, functor, and applicative functor interfaces.`js
// Maybe monad
require('akh.maybe').Maybe
require('akh').Maybe// Maybe monad transformer
require('akh.maybe').MaybeT
require('akh').MaybeT
`####
Maybe.run(m), m.run()
Perform a error computation m and return a maybe object result`js
Maybe.run(Maybe.just(3).map(x => -x)) === { just: true, value: -3 }
Maybe.run(Maybe.nothing.map(x => -x)) === { nothing: true }
`####
MaybeT.run(t), t.run()
Same as Maybe.run but for a monad transformer. Returns an Maybe value inside of the inner monad.
####
Maybe.maybe(m, def), m.maybe(def)
Perform an maybe computation m and return the result if it succeeds and def if it fails.
Maybe Interface
####
Maybe.just(x)
#### MaybeT(m).just(x)
Same as Maybe.of. Success value.####
Maybe.nothing
#### MaybeT(m).nothing
Error value
Contributing
Contributions are welcome.To get started:
`bash
$ cd akh-maybe
$ npm install # install dev packages
$ npm test # run tests
``[fl]: https://github.com/fantasyland/fantasy-land