Skip to content

Commit ea886bb

Browse files
committed
Updates for RC
1 parent 36270ad commit ea886bb

File tree

12 files changed

+118
-56
lines changed

12 files changed

+118
-56
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/.*
22
!/.gitignore
3+
!/.jscsrc
4+
!/.jshintrc
35
!/.travis.yml
46
/bower_components/
57
/node_modules/
68
/output/
7-
/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+
}

bower.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
{
2-
"name": "purescript-semirings",
3-
"moduleType": [
4-
"node"
2+
"name": "purescript-refs",
3+
"homepage": "https://github.com/purescript/purescript-refs",
4+
"description": "Mutable value references",
5+
"keywords": [
6+
"purescript"
57
],
8+
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/purescript/purescript-refs.git"
12+
},
613
"ignore": [
714
"**/.*",
8-
"node_modules",
915
"bower_components",
16+
"node_modules",
1017
"output",
18+
"test",
1119
"bower.json",
1220
"gulpfile.js",
1321
"package.json"
1422
],
1523
"dependencies": {
16-
"purescript-eff": "~0.1.0"
24+
"purescript-eff": "^0.1.0",
25+
"purescript-prelude": "^0.1.0"
1726
}
1827
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Module Control.Monad.Eff.Ref.Unsafe
2+
3+
Unsafe functions for working with mutable references.
4+
5+
#### `unsafeRunRef`
6+
7+
``` purescript
8+
unsafeRunRef :: forall eff a. Eff (ref :: REF | eff) a -> Eff eff a
9+
```
10+
11+
This handler function unsafely removes the `Ref` effect from an
12+
effectful action.
13+
14+
This function might be used when it is impossible to prove to the
15+
typechecker that a particular mutable reference does not escape
16+
its scope.
17+
18+

docs/Control.Monad.Eff.Ref.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# Module Documentation
2-
31
## Module Control.Monad.Eff.Ref
42

5-
63
This module defines an effect and actions for working with
74
global mutable variables.
85

@@ -46,7 +43,7 @@ Read the current value of a mutable reference
4643
#### `modifyRef'`
4744

4845
``` purescript
49-
modifyRef' :: forall s b r. Ref s -> (s -> { value :: b, state :: s }) -> Eff (ref :: REF | r) b
46+
modifyRef' :: forall s b r. Ref s -> (s -> { state :: s, value :: b }) -> Eff (ref :: REF | r) b
5047
```
5148

5249
Update the value of a mutable reference by applying a function
@@ -70,4 +67,3 @@ writeRef :: forall s r. Ref s -> s -> Eff (ref :: REF | r) Unit
7067
Update the value of a mutable reference to the specified value.
7168

7269

73-

docs/Control.Monad.Eff.Unsafe.md

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

gulpfile.js

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,61 @@
1+
/* jshint node: true */
12
"use strict";
23

34
var gulp = require("gulp");
5+
var jshint = require("gulp-jshint");
6+
var jscs = require("gulp-jscs");
47
var plumber = require("gulp-plumber");
58
var purescript = require("gulp-purescript");
6-
var jsvalidate = require("gulp-jsvalidate");
9+
var rimraf = require("rimraf");
710

8-
var paths = [
11+
var sources = [
912
"src/**/*.purs",
1013
"bower_components/purescript-*/src/**/*.purs"
1114
];
1215

13-
gulp.task("make", function() {
14-
return gulp.src(paths)
15-
.pipe(plumber())
16-
.pipe(purescript.pscMake());
16+
var foreigns = [
17+
"src/**/*.js",
18+
"bower_components/purescript-*/src/**/*.js"
19+
];
20+
21+
gulp.task("clean-docs", function (cb) {
22+
rimraf("docs", cb);
1723
});
1824

19-
gulp.task("jsvalidate", ["make"], function () {
20-
return gulp.src("output/**/*.js")
21-
.pipe(plumber())
22-
.pipe(jsvalidate());
25+
gulp.task("clean-output", function (cb) {
26+
rimraf("output", cb);
2327
});
2428

25-
var docTasks = [];
29+
gulp.task("clean", ["clean-docs", "clean-output"]);
2630

27-
var docTask = function(name) {
28-
var taskName = "docs-" + name.toLowerCase();
29-
gulp.task(taskName, function () {
30-
return gulp.src("src/" + name.replace(/\./g, "/") + ".purs")
31-
.pipe(plumber())
32-
.pipe(purescript.pscDocs())
33-
.pipe(gulp.dest("docs/" + name + ".md"));
34-
});
35-
docTasks.push(taskName);
36-
};
31+
gulp.task("lint", function() {
32+
return gulp.src("src/**/*.js")
33+
.pipe(jshint())
34+
.pipe(jshint.reporter())
35+
.pipe(jscs());
36+
});
3737

38-
["Control.Monad.Eff.Ref", "Control.Monad.Eff.Unsafe"].forEach(docTask);
38+
gulp.task("make", ["lint"], function() {
39+
return gulp.src(sources)
40+
.pipe(plumber())
41+
.pipe(purescript.pscMake({ ffi: foreigns }));
42+
});
3943

40-
gulp.task("docs", docTasks);
44+
gulp.task("docs", ["clean-docs"], function () {
45+
return gulp.src(sources)
46+
.pipe(plumber())
47+
.pipe(purescript.pscDocs({
48+
docgen: {
49+
"Control.Monad.Eff.Ref": "docs/Control.Monad.Eff.Ref.md",
50+
"Control.Monad.Eff.Ref.Unsafe": "docs/Control.Monad.Eff.Ref.Unsafe.md"
51+
}
52+
}));
53+
});
4154

4255
gulp.task("dotpsci", function () {
43-
return gulp.src(paths)
56+
return gulp.src(sources)
4457
.pipe(plumber())
4558
.pipe(purescript.dotPsci());
4659
});
4760

48-
gulp.task("default", ["jsvalidate", "docs", "dotpsci"]);
61+
gulp.task("default", ["make", "docs", "dotpsci"]);

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"private": true,
33
"devDependencies": {
44
"gulp": "^3.8.11",
5-
"gulp-jsvalidate": "^1.0.1",
5+
"gulp-jscs": "^1.6.0",
6+
"gulp-jshint": "^1.10.0",
67
"gulp-plumber": "^1.0.0",
7-
"gulp-purescript": "^0.3.1"
8+
"gulp-purescript": "^0.5.0-rc.1",
9+
"rimraf": "^2.3.3"
810
}
911
}

src/Control/Monad/Eff/Ref.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33

44
// module Control.Monad.Eff.Ref
55

6-
exports.newRef = function(val) {
6+
exports.newRef = function (val) {
77
return function () {
88
return { value: val };
99
};
1010
};
1111

12-
exports.readRef = function(ref) {
13-
return function() {
12+
exports.readRef = function (ref) {
13+
return function () {
1414
return ref.value;
1515
};
1616
};
1717

18-
exports.modifyRef$prime = function(ref) {
19-
return function(f) {
20-
return function() {
18+
exports["modifyRef'"] = function (ref) {
19+
return function (f) {
20+
return function () {
2121
var t = f(ref.value);
2222
ref.value = t.state;
2323
return t.value;
2424
};
2525
};
2626
};
2727

28-
exports.writeRef = function(ref) {
29-
return function(val) {
30-
return function() {
28+
exports.writeRef = function (ref) {
29+
return function (val) {
30+
return function () {
3131
ref.value = val;
3232
return {};
3333
};

0 commit comments

Comments
 (0)