Skip to content
This repository was archived by the owner on Jul 25, 2018. It is now read-only.

Commit c75a2cc

Browse files
Updated to the new fantasy land
1 parent b95b03a commit c75a2cc

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

fantasy-consts.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
const Const = require('./src/const');
44

5-
if (typeof module != 'undefined')
6-
module.exports = Const;
5+
module.exports = Const;

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"url": "https://github.com/fantasyland/fantasy-consts/issues"
1717
},
1818
"dependencies": {
19-
"daggy": "0.0.1"
19+
"daggy": "0.0.1",
20+
"fantasy-land": "git+https://github.com/fantasyland/fantasy-land.git"
2021
},
2122
"devDependencies": {
2223
"nodeunit": "0.9.x",

src/const.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22

33
const {tagged} = require('daggy');
44
const Const = tagged('x');
5+
const {of, ap, concat, map} = require('fantasy-land');
56

6-
Const.of = (x) => Const(x.empty());
7+
Const[of] = (x) => Const(x.empty());
78

8-
Const.prototype.ap = function(fa) {
9-
return this.concat(fa);
9+
Const.prototype[ap] = function(fa) {
10+
return this[concat](fa);
1011
};
1112

12-
Const.prototype.concat = function(y) {
13-
return Const(this.x.concat(y.x));
13+
Const.prototype[concat] = function(y) {
14+
return Const(this.x[concat](y.x));
1415
};
1516

16-
Const.prototype.map = function(f) {
17+
Const.prototype[map] = function(f) {
1718
return Const(this.x);
1819
};
1920

20-
// Export
21-
if (typeof module != 'undefined')
22-
module.exports = Const;
21+
module.exports = Const;

0 commit comments

Comments
 (0)