akh.codensity
v0.0.3
Published
Akh codensity monad
Downloads
1,944
Maintainers
Readme
Codensity for the Akh Javascript Monad Transformer Library
Includes both regular codensity monad Codensity
and codensity monad transformer CodensityT
.
# To use as standalone package
$ npm install --save akh.codensity
# To use as part of akh library
$ npm install --save akh
Usage
The codensity monad/transformer implements the Fantasy Land monad and monoid interfaces.
// Codensity monad
require('akh.codensity').Codensity
require('akh').Codensity
// Codensity monad transformer
require('akh.codensity').CodensityT
require('akh').CodensityT
Codensity.run(m, k)
, m.run(k)
Perform a codensity computation m
and complete with outer continuation k
.
const Codensity = requre('akh.Codensity').Codensity
var c = Codensity.of(3).map(x => -x)
Codensity.run(c, console.log) // logs: -3
c.run(console.log)
CodensityT.run(m, k)
, m.run(k)
Same as Codensity.run
but for transformed types
Contributing
Contributions are welcome.
To get started:
$ cd akh-codensity
$ npm install # install dev packages
$ npm test # run tests