Skip to content

rehno-lindeque/adt-util.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adt-util.js

Practical, generic utilities for working with adt.js.

Usage

Construct and adt from an object

TODO... adt.fromObject(...)

Create partial evaluators

var
  comparison = adt({
    eq: function(a,b) { return a === b; },
    lt: function(a,b) { return a < b; },
    gt: function(a,b) { return a <= b; },
    lte: function(a,b) { return a > b; },
    gte: function(a,b) { return a >= b; }
  }),
  comparisonPartial = adt.partial(comparison),
  atLeast5 = comparisonPartial.lte(5);

console.log("Is 4 at least as big as 5? " + (atLeast5(4)? "yes" : "no"));
console.log("Is 5 at least as big as 5? " + (atLeast5(5)? "yes" : "no"));

About

Practical, generic utilities for working with adt.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published