New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

akh

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akh - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

dist_node/_tail.js

36

dist_node/base.js

@@ -6,21 +6,15 @@ /*

"use strict";
var liftM, liftM2, next, sequencea, sequence, mapM, foldM, flip = (function(f) {
return (function(x, y) {
return f(y, x);
});
}),
reducer = (function(f, a) {
return Array.prototype.reduceRight.call(a, f);
}),
foldr = (function(f, z, a) {
return Array.prototype.reduceRight.call(a, f, z);
}),
map = (function(f, a) {
return Array.prototype.map.call(a, f);
}),
concat = Function.prototype.call.bind(Array.prototype.concat),
flatten = Function.prototype.apply.bind(Array.prototype.concat, []),
cons = (function(x, xs) {
return [x].concat(xs);
});
var chain, map, ap, concat, liftM, liftM2, next, sequencea, sequence, mapM, foldM;
(chain = (function(c, f) {
return c.chain(f);
}));
(map = (function(f, m) {
return m.map(f);
}));
(ap = (function(f, a) {
return f.ap(a);
}));
(concat = (function(a, b) {
return a.concat(b);
}));
(liftM = (function(f, m) {

@@ -52,2 +46,6 @@ return m.chain((function(f, g) {

}));
(exports["chain"] = chain);
(exports["map"] = map);
(exports["ap"] = ap);
(exports["concat"] = concat);
(exports["liftM"] = liftM);

@@ -54,0 +52,0 @@ (exports["liftM2"] = liftM2);

@@ -16,6 +16,8 @@ /*

})(Identity.runIdentity, (function(m, k) {
return runDContT(m, (function(x) {
return new(Identity)(k(x));
}));
return runDContT(m, (function(f, g) {
return (function(x) {
return f(g(x));
});
})(Identity.of, k));
})));
(module.exports = DCont);

@@ -7,5 +7,9 @@ /*

var __o = require("../structure"),
Functor = __o["Functor"],
Monad = __o["Monad"],
ContT;
__o0 = require("../_tail"),
Tail = __o0["Tail"],
trampoline = __o0["trampoline"],
ContT, runContT = (function(m, k) {
return new(Tail)(m.run, k);
});
(ContT = (function(m) {

@@ -22,4 +26,4 @@ var reify, Instance = (function(run) {

return new(Instance)((function(k) {
return ContT.runContT(c, (function(x) {
return ContT.runContT(f(x), k);
return runContT(c, (function(x) {
return runContT(f(x), k);
}));

@@ -36,15 +40,17 @@ }));

return new(Instance)((function(k) {
return ContT.runContT(f(reify(k)), k);
return runContT(f(reify(k)), k);
}));
}))));
(Instance.lift = (function(t) {
(Instance.lift = (Instance.prototype.lift = (function(t) {
return new(Instance)((function(k) {
return t.chain(k);
}));
}));
})));
return Instance;
}));
(ContT.runContT = (function(m, k) {
return m.run(k);
}));
(ContT.runContT = (function(f, g) {
return (function() {
return f(g.apply(null, arguments));
});
})(trampoline, runContT));
(module.exports = ContT);
/*
* THIS FILE IS AUTO GENERATED from 'lib/trans/dcont.kep'
* THIS FILE IS AUTO GENERATED FROM 'lib/trans/dcont.kep'
* DO NOT EDIT
*/"use strict";
*/
"use strict";
var stream = require("nu-stream")["stream"],

@@ -9,6 +10,8 @@ first = stream["first"],

isEmpty = stream["isEmpty"],
State = require("../state"),
Unique = require("../unique"),
__o = require("../structure"),
Functor = __o["Functor"],
Monad = __o["Monad"],
__o0 = require("../_tail"),
Tail = __o0["Tail"],
trampoline = __o0["trampoline"],
DContT, Seg = (function(f) {

@@ -42,11 +45,17 @@ var self = this;

unDContT = (function(m, k) {
return m.run(k);
return new(Tail)(m.run, k);
}),
runDContT = (function(m, k) {
return State.evalState(unDContT(m, k), 1);
}),
runDContT = (function(f, g) {
return (function() {
return f(g.apply(null, arguments));
});
})((function(f, g) {
return (function(x) {
return f(g(x));
});
})(Unique.runUnique, trampoline), unDContT),
appk = (function(k, x) {
var c = k;
do {
if (((typeof c) === "function")) return State.of(c(x));
if (((typeof c) === "function")) return Unique.of(c(x));
var top = first(c);

@@ -57,9 +66,3 @@ if ((top instanceof Seg)) return unDContT(top.frame(x), rest(c));

while (true);
}),
createPrompt = State.get.chain((function(x) {
return State.put((x + 1))
.chain((function() {
return State.of(x);
}));
}));
});
(DContT = (function(m) {

@@ -81,7 +84,11 @@ var Instance = (function(run) {

return new(Instance)((function(k) {
return State.of(t.chain(appk.bind(null, k)));
return Unique.of(t.chain(appk.bind(null, k)));
}));
}));
(Instance.newPrompt = (Instance.prototype.newPrompt = new(Instance)((function(k) {
return createPrompt.chain(appk.bind(null, k));
return Unique.unique.chain((function(f, g) {
return (function(x) {
return f(g(x));
});
})(trampoline, appk.bind(null, k)));
}))));

@@ -88,0 +95,0 @@ (Instance.pushPrompt = (Instance.prototype.pushPrompt = (function(prompt, c) {

@@ -7,3 +7,2 @@ /*

var __o = require("../structure"),
Functor = __o["Functor"],
Monad = __o["Monad"],

@@ -16,2 +15,5 @@ Monoid = __o["Monoid"],

});
}),
runStateT = (function(m, s) {
return m.run(s);
});

@@ -29,7 +31,7 @@ (StateT = (function(m) {

return new(Instance)((function(s) {
return StateT.runStateT(c, s)
return runStateT(c, s)
.chain((function(__o) {
var x = __o["x"],
s = __o["s"];
return StateT.runStateT(f(x), s);
return runStateT(f(x), s);
}));

@@ -42,15 +44,22 @@ }));

return new(Instance)((function(s) {
return StateT.runStateT(a, s)
.concat(StateT.runStateT(b, s));
return runStateT(a, s)
.concat(runStateT(b, s));
}));
}));
(Instance.get = new(Instance)((function(s) {
(Instance.get = (Instance.prototype.get = new(Instance)((function(s) {
return m.of(Pair(s, s));
})));
(Instance.put = (function(s) {
}))));
(Instance.put = (Instance.prototype.put = (function(s) {
return new(Instance)((function(_) {
return m.of(Pair(s, s));
}));
}));
(Instance.lift = (function(t) {
})));
(Instance.modify = (Instance.prototype.modify = (function(f) {
return Instance.get.chain((function(f, g) {
return (function(x) {
return f(g(x));
});
})(Instance.put, f));
})));
(Instance.lift = (Instance.prototype.lift = (function(t) {
return new(Instance)((function(s) {

@@ -61,8 +70,6 @@ return t.chain((function(x) {

}));
}));
})));
return Instance;
}));
(StateT.runStateT = (function(m, s) {
return m.run(s);
}));
(StateT.runStateT = runStateT);
(StateT.evalStateT = (function(f, g) {

@@ -69,0 +76,0 @@ return (function() {

{
"name": "akh",
"version": "0.4.0",
"version": "0.5.0",
"description": "Monad and Monad Transformer Collection",

@@ -5,0 +5,0 @@ "author": "Matt Bierner",

@@ -32,3 +32,2 @@ # Akh

## Contribute

@@ -35,0 +34,0 @@ Improvement and additions to Akh are welcome. Please report any [issues][issues]

@@ -42,2 +42,17 @@ var Cont = require('../index').cont;

exports.many_chain = function(test) {
var c = Cont.of(0);
for (var i = 0; i < 10000; ++i) {
c = c.chain(function(x) {
return Cont.of(x + 1);
});
}
test.deepEqual(
Cont.runCont(c, sqr),
10000 * 10000);
test.done();
};
exports.simple_callcc = function(test) {

@@ -44,0 +59,0 @@ var c = Cont.of(3)

@@ -42,2 +42,24 @@ var DCont = require('../index').dcont;

exports.many_chain = function(test) {
var c = DCont.of(0);
for (var i = 0; i < 10000; ++i) {
c = c.chain(function(x) {
return DCont.of(x + 1);
});
}
try {
DCont.runDCont(c, sqr);
} catch (e) {
console.log('x', e);
}
test.deepEqual(
DCont.runDCont(c, sqr),
10000 * 10000);
test.done();
};
exports.single_shift_reset = function(test) {

@@ -44,0 +66,0 @@ var c = DCont

@@ -40,5 +40,6 @@ var State = require('../index').state;

exports.put = function(test) {
var c = State.of(3).chain(function(x) {
return State.put(x);
})
var c = State.of(3)
.chain(function(x) {
return State.put(x);
});

@@ -50,1 +51,29 @@ test.deepEqual(

};
exports.modify = function(test) {
var c = State.of(3)
.chain(function(x) {
return State.modify(function(y) { return x * y});
});
test.deepEqual(
State.execState(c, 4),
12);
test.done();
};
/*
exports.many_chain = function(test) {
var c = State.of(0);
for (var i = 0; i < 10000; ++i) {
c = c.chain(function(x) {
return State.of(x + 1);
});
}
test.deepEqual(
State.runState(c, 's'),
{'x': 10000, 's': 's'});
test.done();
};*/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc