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

Commit 1a7caa0

Browse files
committed
Updates for RC
1 parent 82b77e7 commit 1a7caa0

File tree

7 files changed

+101
-109
lines changed

7 files changed

+101
-109
lines changed

.gitignore

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
.psci
2-
.psci_modules/
3-
node_modules
4-
bower_components
5-
dist
1+
/.*
2+
!/.gitignore
3+
!/.travis.yml
4+
/bower_components/
5+
/node_modules/
6+
/output/

.travis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
node_js:
3+
- 0.10
4+
env:
5+
- PATH=$HOME/purescript:$PATH
6+
install:
7+
- 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')
8+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
9+
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
10+
- chmod a+x $HOME/purescript
11+
- npm install bower gulp -g
12+
- npm install && bower install
13+
script:
14+
- gulp

README.md

+7-44
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,15 @@
1-
# Module Documentation
1+
# purescript-inject
22

3-
## Module Data.Inject
3+
[![Build Status](https://travis-ci.org/purescript/purescript-inject.svg?branch=master)](https://travis-ci.org/purescript/purescript-inject)
44

5+
Inject typeclass.
56

6-
This module defines a type class `Inject` which is useful
7-
when working with coproducts of functors.
7+
## Installation
88

9-
#### `Inject`
10-
11-
``` purescript
12-
class Inject f g where
13-
inj :: forall a. f a -> g a
14-
prj :: forall a. g a -> Maybe (f a)
159
```
16-
17-
The `Inject` class asserts a coproduct relationship between two functors.
18-
19-
Specifically, an instance `Inject f g` indicates that `g` is isomorphic to
20-
a coproduct of `f` and some third functor.
21-
22-
Laws:
23-
24-
- `prj g = Just f` if and only if `inj f = g`
25-
26-
#### `injectReflexive`
27-
28-
``` purescript
29-
instance injectReflexive :: Inject f f
10+
bower install purescript-inject
3011
```
3112

32-
Any functor is isomorphic to the coproduct of itself with the
33-
constantly-`Void` functor.
34-
35-
#### `injectLeft`
36-
37-
``` purescript
38-
instance injectLeft :: Inject f (Coproduct f g)
39-
```
40-
41-
Left injection
42-
43-
#### `injectRight`
44-
45-
``` purescript
46-
instance injectRight :: (Inject f g) => Inject f (Coproduct h g)
47-
```
48-
49-
Right injection
50-
51-
13+
## Module documentation
5214

15+
- [Data.Inject](docs/Data.Inject.md)

bower.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
"dist"
1515
],
1616
"dependencies": {
17-
"purescript-coproducts": "~0.4.0",
18-
"purescript-either": "~0.2.0",
19-
"purescript-maybe": "~0.3.0"
17+
"purescript-coproducts": "^0.4.0"
2018
}
2119
}

docs/Data.Inject.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Module Data.Inject
2+
3+
This module defines a type class `Inject` which is useful
4+
when working with coproducts of functors.
5+
6+
#### `Inject`
7+
8+
``` purescript
9+
class Inject f g where
10+
inj :: forall a. f a -> g a
11+
prj :: forall a. g a -> Maybe (f a)
12+
```
13+
14+
The `Inject` class asserts a coproduct relationship between two functors.
15+
16+
Specifically, an instance `Inject f g` indicates that `g` is isomorphic to
17+
a coproduct of `f` and some third functor.
18+
19+
Laws:
20+
21+
- `prj g = Just f` if and only if `inj f = g`
22+
23+
##### Instances
24+
``` purescript
25+
instance injectReflexive :: Inject f f
26+
instance injectLeft :: Inject f (Coproduct f g)
27+
instance injectRight :: (Inject f g) => Inject f (Coproduct h g)
28+
```
29+
30+

gulpfile.js

+39-51
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,51 @@
1-
var gulp = require('gulp')
2-
, gutil = require('gulp-util')
3-
, plumber = require('gulp-plumber')
4-
, purescript = require('gulp-purescript')
5-
, sequence = require('run-sequence')
6-
, del = require('del')
7-
, config = {
8-
del: ['dist'],
9-
purescript: {
10-
src: [
11-
'bower_components/purescript-*/src/**/*.purs*',
12-
'src/**/*.purs'
13-
],
14-
dest: 'dist',
15-
docs: 'README.md'
16-
}
17-
}
18-
;
1+
/* jshint node: true */
2+
"use strict";
193

20-
function error(e) {
21-
gutil.log(gutil.colors.magenta('>>>> Error <<<<') + '\n' + e.toString().trim());
22-
this.emit('end');
23-
}
4+
var gulp = require("gulp");
5+
var plumber = require("gulp-plumber");
6+
var purescript = require("gulp-purescript");
7+
var rimraf = require("rimraf");
248

25-
gulp.task('del', function(cb){
26-
del(config.del, cb);
27-
});
9+
var sources = [
10+
"src/**/*.purs",
11+
"bower_components/purescript-*/src/**/*.purs"
12+
];
13+
14+
var foreigns = [
15+
"src/**/*.js",
16+
"bower_components/purescript-*/src/**/*.js"
17+
];
2818

29-
gulp.task('make', function(){
30-
return (
31-
gulp.src(config.purescript.src).
32-
pipe(plumber()).
33-
pipe(purescript.pscMake({output: config.purescript.dest})).
34-
on('error', error)
35-
);
19+
gulp.task("clean-docs", function (cb) {
20+
rimraf("docs", cb);
3621
});
3722

38-
gulp.task('psci', function(){
39-
return (
40-
gulp.src(config.purescript.src).
41-
pipe(plumber()).
42-
pipe(purescript.dotPsci()).
43-
on('error', error)
44-
);
23+
gulp.task("clean-output", function (cb) {
24+
rimraf("output", cb);
4525
});
4626

47-
gulp.task('docs', function(){
48-
return (
49-
gulp.src(config.purescript.src[1]).
50-
pipe(plumber()).
51-
pipe(purescript.pscDocs()).
52-
on('error', error).
53-
pipe(gulp.dest(config.purescript.docs))
54-
);
27+
gulp.task("clean", ["clean-docs", "clean-output"]);
28+
29+
gulp.task("make", function() {
30+
return gulp.src(sources)
31+
.pipe(plumber())
32+
.pipe(purescript.pscMake({ ffi: foreigns }));
5533
});
5634

57-
gulp.task('watch', function(cb){
58-
gulp.watch(config.purescript.src, ['make']);
35+
gulp.task("docs", ["clean-docs"], function () {
36+
return gulp.src(sources)
37+
.pipe(plumber())
38+
.pipe(purescript.pscDocs({
39+
docgen: {
40+
"Data.Inject": "docs/Data.Inject.md"
41+
}
42+
}));
5943
});
6044

61-
gulp.task('default', function(){
62-
sequence('del', 'make', ['psci', 'docs']);
45+
gulp.task("dotpsci", function () {
46+
return gulp.src(sources)
47+
.pipe(plumber())
48+
.pipe(purescript.dotPsci());
6349
});
50+
51+
gulp.task("default", ["make", "docs", "dotpsci"]);

package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"private": true,
33
"devDependencies": {
4-
"del": "0.1.3",
5-
"gulp": "3.8.10",
6-
"gulp-plumber": "0.5.6",
7-
"gulp-purescript": "0.1.2",
8-
"gulp-util": "2.2.14",
9-
"run-sequence": "0.3.6"
4+
"gulp": "^3.8.11",
5+
"gulp-plumber": "^1.0.0",
6+
"gulp-purescript": "^0.5.0-rc.1",
7+
"rimraf": "^2.3.3"
108
}
119
}

0 commit comments

Comments
 (0)