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

Commit 698196f

Browse files
committed
Merge pull request #35 from purescript/0.9-updates
Updates for PureScript 0.9
2 parents fd769ec + 98be844 commit 698196f

File tree

11 files changed

+481
-496
lines changed

11 files changed

+481
-496
lines changed

.gitignore

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

.jscsrc

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

.jshintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"freeze": true,
66
"funcscope": true,
77
"futurehostile": true,
8-
"globalstrict": true,
8+
"strict": "global",
99
"latedef": true,
1010
"maxparams": 1,
1111
"noarg": true,
@@ -15,5 +15,6 @@
1515
"singleGroups": true,
1616
"undef": true,
1717
"unused": true,
18-
"eqnull": true
18+
"eqnull": true,
19+
"predef": ["exports"]
1920
}

.travis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
language: node_js
2-
sudo: false
3-
node_js:
4-
- 0.10
2+
dist: trusty
3+
sudo: required
4+
node_js: 6
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:
88
- 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')
99
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1010
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
1111
- chmod a+x $HOME/purescript
12+
- npm install -g bower
1213
- npm install
1314
script:
14-
- npm run build
15+
- bower install --production
16+
- npm run -s build
17+
- bower install
18+
- npm -s test
19+
after_success:
20+
- >-
21+
test $TRAVIS_TAG &&
22+
echo $GITHUB_TOKEN | pulp login &&
23+
echo y | pulp publish --no-push

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@
44
[![Build Status](https://travis-ci.org/purescript/purescript-generics.svg?branch=master)](https://travis-ci.org/purescript/purescript-generics)
55
[![Dependency Status](https://www.versioneye.com/user/projects/5620cd8436d0ab00160009c5/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5620cd8436d0ab00160009c5)
66

7-
Generic Programming.
8-
9-
- [Module Documentation](docs/Data/)
10-
- [Example](test/Main.purs)
7+
Generic programming.
118

129
## Usage
1310

1411
```
1512
bower install purescript-generics
1613
```
1714

18-
The methods in the `Generic` type class can be derived in versions >= 0.7.3 of the PureScript compiler. Simply omit their definitions to derive them.
15+
The methods in the `Generic` type class can be derived in versions >= 0.7.3 of the PureScript compiler with the following syntax:
16+
17+
``` purescript
18+
derive instance genericMyType :: Generic MyType
19+
```
20+
21+
There are some example usages of the library [in the tests](test/Main.purs).
22+
23+
## Documentation
24+
25+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-generics).

bower.json

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
{
22
"name": "purescript-generics",
33
"homepage": "https://github.com/purescript-contrib/purescript-generics",
4+
"description": "Generic programming for PureScript",
45
"authors": [
56
"Gershom Bazerman <[email protected]>"
67
],
7-
"description": "Generic programming",
8-
"keywords": [
9-
"purescript",
10-
"generic"
11-
],
12-
"moduleType": [
13-
"node"
14-
],
158
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/purescript/purescript-generics.git"
12+
},
1613
"ignore": [
1714
"**/.*",
1815
"bower_components",
1916
"node_modules",
20-
"output"
17+
"output",
18+
"test",
19+
"bower.json",
20+
"package.json"
2121
],
22-
"repository": {
23-
"type": "git",
24-
"url": "git://github.com/purescript/purescript-generics.git"
25-
},
2622
"dependencies": {
27-
"purescript-arrays": "^0.4.2",
28-
"purescript-either": "^0.2.1",
29-
"purescript-proxy": "^0.1.0",
30-
"purescript-strings": "^0.7.0"
23+
"purescript-arrays": "^1.0.0-rc.1",
24+
"purescript-either": "^1.0.0-rc.1",
25+
"purescript-proxy": "^1.0.0-rc.1",
26+
"purescript-strings": "^1.0.0-rc.1"
3127
},
3228
"devDependencies": {
33-
"purescript-console": "^0.1.0",
34-
"purescript-assert": "^0.1.1"
29+
"purescript-assert": "^1.0.0-rc.1",
30+
"purescript-console": "^1.0.0-rc.1"
3531
}
3632
}

docs/Data/Generic.md

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

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
22
"private": true,
33
"scripts": {
4-
"postinstall": "pulp dep install",
5-
"build": "jshint src && pulp test && rimraf docs && pulp docs"
4+
"clean": "rimraf output && rimraf .pulp-cache",
5+
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
6+
"test": "pulp test"
67
},
78
"devDependencies": {
8-
"jshint": "^2.8.0",
9-
"pulp": "^4.0.1",
10-
"rimraf": "^2.4.1"
9+
"jscs": "^2.8.0",
10+
"jshint": "^2.9.1",
11+
"pulp": "^8.2.0",
12+
"purescript-psa": "^0.3.8",
13+
"rimraf": "^2.5.0"
1114
}
1215
}

src/Data/Generic.js

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,41 @@
1-
/* global exports */
21
"use strict";
32

43
// module Data.Generic
54

6-
7-
//------------------------------------------------------------------------------
8-
// Zipping ---------------------------------------------------------------------
9-
//------------------------------------------------------------------------------
10-
11-
exports.zipAll = function(f) {
12-
return function(xs) {
13-
return function(ys) {
14-
var l = xs.length < ys.length ? xs.length : ys.length;
15-
for (var i = 0; i < l; i++) {
16-
if (!f(xs[i])(ys[i])) {
17-
return false;
18-
}
19-
}
20-
return true;
21-
};
5+
exports.zipAll = function (f) {
6+
return function (xs) {
7+
return function (ys) {
8+
var l = xs.length < ys.length ? xs.length : ys.length;
9+
for (var i = 0; i < l; i++) {
10+
if (!f(xs[i])(ys[i])) {
11+
return false;
12+
}
13+
}
14+
return true;
2215
};
16+
};
2317
};
2418

25-
exports.zipCompare = function(f) {
26-
return function(xs) {
27-
return function(ys) {
28-
var i = 0;
29-
var xlen = xs.length;
30-
var ylen = ys.length;
31-
while (i < xlen && i < ylen) {
32-
var o = f(xs[i])(ys[i]);
33-
if (o !== 0) {
34-
return o;
35-
}
36-
i++;
37-
}
38-
if (xlen === ylen) {
39-
return 0;
40-
} else if (xlen > ylen) {
41-
return -1;
42-
} else {
43-
return 1;
44-
}
45-
};
19+
exports.zipCompare = function (f) {
20+
return function (xs) {
21+
return function (ys) {
22+
var i = 0;
23+
var xlen = xs.length;
24+
var ylen = ys.length;
25+
while (i < xlen && i < ylen) {
26+
var o = f(xs[i])(ys[i]);
27+
if (o !== 0) {
28+
return o;
29+
}
30+
i++;
31+
}
32+
if (xlen === ylen) {
33+
return 0;
34+
} else if (xlen > ylen) {
35+
return -1;
36+
} else {
37+
return 1;
38+
}
4639
};
40+
};
4741
};

0 commit comments

Comments
 (0)