Comparing version 1.0.0 to 1.0.1
@@ -13,3 +13,4 @@ /* | ||
(Instance.prototype.ap = ap); | ||
Functor(Instance, (Instance.map || (function(f, m) { | ||
Functor(Instance, (Instance.prototype.map || (function(f) { | ||
var m = this; | ||
return of(f) | ||
@@ -26,7 +27,4 @@ .ap(m); | ||
(Functor = (function(Instance, map) { | ||
(Instance.map = map); | ||
(Instance.prototype.map = (function(f) { | ||
var self = this; | ||
return map(f, self); | ||
})); | ||
(Instance.map = base.map); | ||
(Instance.prototype.map = map); | ||
return Instance; | ||
@@ -44,4 +42,4 @@ })); | ||
Chain(Instance, chain); | ||
Functor(Instance, (Instance.prototype.map || (function(f, m) { | ||
var x, y; | ||
Functor(Instance, (Instance.prototype.map || (function(f) { | ||
var x, y, m = this; | ||
return m.chain(((x = f), (y = m.of), (function(x0) { | ||
@@ -51,3 +49,4 @@ return y(x(x0)); | ||
}))); | ||
Applicative(Instance, of, (Instance.prototype.ap || (function(f, m) { | ||
Applicative(Instance, of, (Instance.prototype.ap || (function(m) { | ||
var f = this; | ||
return f.chain((function(f0) { | ||
@@ -54,0 +53,0 @@ return m.map(f0); |
{ | ||
"name": "akh", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Monad and Monad Transformer Collection", | ||
@@ -5,0 +5,0 @@ "author": "Matt Bierner", |
@@ -128,2 +128,17 @@ var List = require('../index').list; | ||
test.done(); | ||
}; | ||
exports.ap = function(test) { | ||
var c = List.of(function(x) { return x * 2; }) | ||
.ap(List.zero | ||
.concat(List.of(1)) | ||
.concat(List.of(2)) | ||
.concat(List.of(3))); | ||
test.deepEqual( | ||
List.runList(c), | ||
[2, 4, 6]); | ||
test.done(); | ||
}; |
57462
1924