Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit cca72e0

Browse files
committed
Update build, tidy up a few things, make tests work
1 parent 56e16ff commit cca72e0

File tree

19 files changed

+170
-172
lines changed

19 files changed

+170
-172
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/.*
2+
!/.gitignore
3+
!/.jscsrc
4+
!/.jshintrc
5+
!/.travis.yml
26
/bower_components/
37
/node_modules/
48
/output/
5-
/tmp/

.jscsrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"preset": "grunt",
3+
"disallowSpacesInAnonymousFunctionExpression": null,
4+
"requireSpacesInAnonymousFunctionExpression": {
5+
"beforeOpeningRoundBrace": true,
6+
"beforeOpeningCurlyBrace": true
7+
},
8+
"disallowSpacesInsideObjectBrackets": null,
9+
"requireSpacesInsideObjectBrackets": "all",
10+
"validateQuoteMarks": "\"",
11+
"requireCurlyBraces": null
12+
}

.jshintrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"bitwise": true,
3+
"eqeqeq": true,
4+
"forin": true,
5+
"freeze": true,
6+
"funcscope": true,
7+
"futurehostile": true,
8+
"globalstrict": true,
9+
"latedef": true,
10+
"maxparams": 1,
11+
"noarg": true,
12+
"nocomma": true,
13+
"nonew": true,
14+
"notypeof": true,
15+
"singleGroups": true,
16+
"undef": true,
17+
"unused": true,
18+
"eqnull": true
19+
}

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- 0.10
5+
env:
6+
- PATH=$HOME/purescript:$PATH
7+
install:
8+
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
9+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
10+
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
11+
- chmod a+x $HOME/purescript
12+
- npm install
13+
script:
14+
- npm run build

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# purescript-maps
22

3-
Purely-functional map data structures
3+
[![Latest release](http://img.shields.io/bower/v/purescript-maps.svg)](https://github.com/purescript/purescript-maps/releases)
4+
[![Build Status](https://travis-ci.org/purescript/purescript-maps.svg?branch=master)](https://travis-ci.org/purescript/purescript-maps)
5+
[![Dependency Status](https://www.versioneye.com/user/projects/55848c1b363861001d000315/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55848c1b363861001d000315)
6+
7+
Purely-functional map data structures.
48

59
## Installation
610

bower.json

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,16 @@
1919
"bower_components",
2020
"node_modules",
2121
"output",
22-
"tests",
23-
"tmp",
22+
"test",
2423
"bower.json",
25-
"Gruntfile.js",
2624
"package.json"
2725
],
28-
"devDependencies": {
29-
"purescript-quickcheck": "^0.6.0"
30-
},
3126
"dependencies": {
32-
"purescript-arrays": "^0.4.0",
33-
"purescript-foldable-traversable": "^0.4.0",
34-
"purescript-strings": "^0.5.0",
35-
"purescript-lists": "^0.7.0",
36-
"purescript-math": "^0.2.0",
37-
"purescript-maybe": "^0.3.0",
38-
"purescript-tuples": "^0.4.0",
39-
"purescript-integers": "^0.2.0",
40-
"purescript-prelude": "^0.1.0",
41-
"purescript-functions": "^0.1.0",
42-
"purescript-eff": "^0.1.0",
43-
"purescript-st": "^0.1.0"
27+
"purescript-lists": "~0.7.0",
28+
"purescript-st": "~0.1.0",
29+
"purescript-functions": "~0.1.0"
30+
},
31+
"devDependencies": {
32+
"purescript-quickcheck": "~0.6.0"
4433
}
4534
}

gulpfile.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"private": true,
3+
"scripts": {
4+
"postinstall": "pulp dep install",
5+
"build": "jshint src && jscs src && pulp test && rimraf docs && pulp docs"
6+
},
37
"devDependencies": {
4-
"gulp": "^3.8.11",
5-
"gulp-plumber": "^1.0.0",
6-
"gulp-purescript": "^0.5.0-rc.1",
7-
"gulp-run": "^1.6.8",
8-
"rimraf": "^2.3.3"
8+
"jscs": "^1.13.1",
9+
"jshint": "^2.8.0",
10+
"pulp": "^4.0.2",
11+
"rimraf": "^2.4.1"
912
}
1013
}

src/Data/Map.purs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ module Data.Map
2828
import Prelude
2929

3030
import Data.Foldable (foldl, foldMap, foldr, Foldable)
31-
import Data.Int ()
31+
import Data.List (List(..), length, nub)
3232
import Data.Maybe (Maybe(..), maybe, isJust)
3333
import Data.Monoid (Monoid)
3434
import Data.Traversable (traverse, Traversable)
3535
import Data.Tuple (Tuple(..), uncurry)
3636

37-
import Data.List (List(..), length, nub)
38-
3937
-- | `Map k v` represents maps from keys of type `k` to values of type `v`.
4038
data Map k v
4139
= Leaf

src/Data/StrMap.js

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,110 +3,131 @@
33

44
// module Data.StrMap
55

6-
exports._copy = function(m) {
6+
exports._copy = function (m) {
77
var r = {};
88
for (var k in m) {
9-
r[k] = m[k];
9+
if (m.hasOwnProperty(k)) {
10+
r[k] = m[k];
11+
}
1012
}
1113
return r;
1214
};
1315

14-
exports._copyEff = function(m) {
15-
return function() {
16+
exports._copyEff = function (m) {
17+
return function () {
1618
var r = {};
1719
for (var k in m) {
18-
r[k] = m[k];
20+
if (m.hasOwnProperty(k)) {
21+
r[k] = m[k];
22+
}
1923
}
2024
return r;
2125
};
2226
};
2327

2428
exports.empty = {};
2529

26-
exports.runST = function(f) {
30+
exports.runST = function (f) {
2731
return f;
2832
};
2933

30-
exports._fmapStrMap = function(m0, f) {
34+
// jshint maxparams: 2
35+
exports._fmapStrMap = function (m0, f) {
3136
var m = {};
3237
for (var k in m0) {
33-
m[k] = f(m0[k]);
38+
if (m.hasOwnProperty(k)) {
39+
m[k] = f(m0[k]);
40+
}
3441
}
3542
return m;
3643
};
3744

38-
exports._foldM = function(bind) {
39-
return function(f) {
40-
return function(mz) {
41-
return function(m) {
42-
function g(k) {
45+
// jshint maxparams: 1
46+
exports._foldM = function (bind) {
47+
return function (f) {
48+
return function (mz) {
49+
return function (m) {
50+
function g (k) {
4351
return function (z) {
4452
return f(z)(k)(m[k]);
4553
};
4654
}
4755
for (var k in m) {
48-
mz = bind(mz)(g(k));
56+
if (m.hasOwnProperty(k)) {
57+
mz = bind(mz)(g(k));
58+
}
4959
}
5060
return mz;
5161
};
5262
};
5363
};
5464
};
5565

56-
exports._foldSCStrMap = function(m, z, f, fromMaybe) {
66+
// jshint maxparams: 4
67+
exports._foldSCStrMap = function (m, z, f, fromMaybe) {
5768
for (var k in m) {
58-
var maybeR = f(z)(k)(m[k]);
59-
var r = fromMaybe(null)(maybeR);
60-
if (r === null) return z;
61-
else z = r;
69+
if (m.hasOwnProperty(k)) {
70+
var maybeR = f(z)(k)(m[k]);
71+
var r = fromMaybe(null)(maybeR);
72+
if (r === null) return z;
73+
else z = r;
74+
}
6275
}
6376
return z;
6477
};
6578

66-
exports.all = function(f) {
67-
return function(m) {
79+
// jshint maxparams: 1
80+
exports.all = function (f) {
81+
return function (m) {
6882
for (var k in m) {
69-
if (!f(k)(m[k])) return false;
83+
if (m.hasOwnProperty(k) && !f(k)(m[k])) return false;
7084
}
7185
return true;
7286
};
7387
};
7488

75-
exports.size = function(m) {
89+
exports.size = function (m) {
7690
var s = 0;
7791
for (var k in m) {
78-
++s;
92+
if (m.hasOwnProperty(k)) {
93+
++s;
94+
}
7995
}
8096
return s;
8197
};
8298

83-
exports._lookup = function(no, yes, k, m) {
99+
// jshint maxparams: 4
100+
exports._lookup = function (no, yes, k, m) {
84101
return k in m ? yes(m[k]) : no;
85102
};
86103

87-
exports._unsafeDeleteStrMap = function(m, k) {
88-
delete m[k];
89-
return m;
104+
// jshint maxparams: 2
105+
exports._unsafeDeleteStrMap = function (m, k) {
106+
delete m[k];
107+
return m;
90108
};
91109

92-
exports._lookupST = function(no, yes, k, m) {
93-
return function() {
110+
// jshint maxparams: 4
111+
exports._lookupST = function (no, yes, k, m) {
112+
return function () {
94113
return k in m ? yes(m[k]) : no;
95-
}
114+
};
96115
};
97116

98-
function _collect(f) {
99-
return function(m) {
117+
function _collect (f) {
118+
return function (m) {
100119
var r = [];
101120
for (var k in m) {
102-
r.push(f(k)(m[k]));
121+
if (m.hasOwnProperty(k)) {
122+
r.push(f(k)(m[k]));
123+
}
103124
}
104125
return r;
105126
};
106-
};
127+
}
107128

108129
exports._collect = _collect;
109130

110-
exports.keys = Object.keys || _collect(function(k) {
111-
return function() { return k; };
112-
});
131+
exports.keys = Object.keys || _collect(function (k) {
132+
return function () { return k; };
133+
});

0 commit comments

Comments
 (0)