0.4.3 • Published 6 years ago

list-monad v0.4.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

list-monad

Monads in JavaScript / sample implemantation

List monad derived from free-monoid

https://www.npmjs.com/package/free-monoid

monad laws validation

const util = require("util");
const validate = a => b => util.inspect(a) === util.inspect(b)
  ? true : false;

const f = x => (M)(x + 7);
const g = x => (M)(x * 5);
const a = 9;
const m = (M)(3)(5)(7);

console.log(
  validate(
    (M)(a).bind(f)
  )(
    f(a)
  )
);
console.log(
  validate(
    m.bind(M)
  )(
    m
  )
);
console.log(
  validate(
    m.bind(f)
      .bind(g)
  )(
    m.bind(x => f(x)
      .bind(g))
  )
);
true
true
true
0.4.3

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago