Skip to content

Commit 1791441

Browse files
authored
Merge pull request #11 from slamdata/compiler/0.12
Compiler/0.12
2 parents bf4fe9c + f302015 commit 1791441

File tree

9 files changed

+432
-336
lines changed

9 files changed

+432
-336
lines changed

.eslintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"strict": [2, "global"],
11+
"block-scoped-var": 2,
12+
"consistent-return": 2,
13+
"eqeqeq": [2, "smart"],
14+
"guard-for-in": 2,
15+
"no-caller": 2,
16+
"no-extend-native": 2,
17+
"no-loop-func": 2,
18+
"no-new": 2,
19+
"no-param-reassign": 2,
20+
"no-return-assign": 2,
21+
"no-unused-expressions": 2,
22+
"no-use-before-define": 2,
23+
"radix": [2, "always"],
24+
"indent": [2, 2],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
# purescript-avar
2-
Low-level interface for asynchronous variables
2+
3+
[![Latest release](http://img.shields.io/github/release/slamdata/purescript-avar.svg)](https://github.com/slamdata/purescript-avar/releases)
4+
[![Build status](https://travis-ci.org/slamdata/purescript-avar.svg?branch=master)](https://travis-ci.org/slamdata/purescript-avar)
5+
6+
Low-level interface for asynchronous variables.
7+
8+
## Installation
9+
10+
```
11+
bower install purescript-avar
12+
```
13+
14+
## Documentation
15+
16+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-avar).
17+

bower.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@
2323
"tests"
2424
],
2525
"dependencies": {
26-
"purescript-eff": "^3.1.0",
27-
"purescript-maybe": "^3.0.0",
28-
"purescript-either": "^3.1.0",
29-
"purescript-functions": "^3.0.0",
30-
"purescript-exceptions": "^3.0.0"
26+
"purescript-aff": "^5.0.0",
27+
"purescript-effect": "^2.0.0",
28+
"purescript-maybe": "^4.0.0",
29+
"purescript-either": "^4.0.0",
30+
"purescript-functions": "^4.0.0",
31+
"purescript-exceptions": "^4.0.0"
3132
},
3233
"devDependencies": {
33-
"purescript-assert": "^3.0.0",
34-
"purescript-console": "^3.0.0",
35-
"purescript-transformers": "^3.4.0",
36-
"purescript-refs": "^3.0.0"
34+
"purescript-assert": "^4.0.0",
35+
"purescript-console": "^4.1.0",
36+
"purescript-transformers": "^4.0.0",
37+
"purescript-refs": "^4.0.0"
3738
}
3839
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src --verbose && pulp build -- --censor-lib --strict",
5+
"build": "eslint src && pulp build -- --censor-lib --strict",
66
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"jshint": "^2.9.5",
10-
"pulp": "^11.0.0",
11-
"purescript-psa": "^0.5.1",
12-
"purescript": "^0.11.5",
13-
"rimraf": "^2.6.1"
9+
"eslint": "^4.19.1",
10+
"pulp": "^12.2.0",
11+
"purescript-psa": "^0.6.0",
12+
"purescript": "slamdata/node-purescript#0.12",
13+
"rimraf": "^2.6.2"
1414
}
1515
}

src/Control/Monad/Eff/AVar.purs

-150
This file was deleted.

src/Control/Monad/Eff/AVar.js renamed to src/Effect/AVar.js

+17-21
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/* globals exports, setTimeout */
2-
/* jshint -W097 */
3-
42
"use strict";
53

64
var AVar = function () {
5+
76
function MutableQueue () {
87
this.head = null;
98
this.last = null;
@@ -28,6 +27,16 @@ var AVar = function () {
2827

2928
var EMPTY = {};
3029

30+
function runEff(eff) {
31+
try {
32+
eff();
33+
} catch (error) {
34+
setTimeout(function () {
35+
throw error;
36+
}, 0);
37+
}
38+
}
39+
3140
function putLast (queue, value) {
3241
var cell = new MutableCell(queue, value);
3342
switch (queue.size) {
@@ -136,8 +145,7 @@ var AVar = function () {
136145

137146
avar.draining = true;
138147

139-
/* jshint -W084 */
140-
while (1) {
148+
while (1) { // eslint-disable-line no-constant-condition
141149
p = null;
142150
r = null;
143151
t = null;
@@ -146,13 +154,13 @@ var AVar = function () {
146154

147155
if (avar.error !== null) {
148156
value = util.left(avar.error);
149-
while (p = takeHead(ps)) {
157+
while (p = takeHead(ps)) { // eslint-disable-line no-cond-assign
150158
runEff(p.cb(value));
151159
}
152-
while (r = takeHead(rs)) {
160+
while (r = takeHead(rs)) { // eslint-disable-line no-cond-assign
153161
runEff(r(value));
154162
}
155-
while (t = takeHead(ts)) {
163+
while (t = takeHead(ts)) { // eslint-disable-line no-cond-assign
156164
runEff(t(value));
157165
}
158166
break;
@@ -190,21 +198,9 @@ var AVar = function () {
190198
break;
191199
}
192200
}
193-
/* jshint +W084 */
194-
195201
avar.draining = false;
196202
}
197203

198-
function runEff(eff) {
199-
try {
200-
eff();
201-
} catch (error) {
202-
setTimeout(function () {
203-
throw error;
204-
}, 0);
205-
}
206-
}
207-
208204
AVar.EMPTY = EMPTY;
209205
AVar.putLast = putLast;
210206
AVar.takeLast = takeLast;
@@ -215,11 +211,11 @@ var AVar = function () {
215211
return AVar;
216212
}();
217213

218-
exports.makeEmptyVar = function () {
214+
exports.empty = function () {
219215
return new AVar(AVar.EMPTY);
220216
};
221217

222-
exports.makeVar = function (value) {
218+
exports._newVar = function (value) {
223219
return function () {
224220
return new AVar(value);
225221
};

0 commit comments

Comments
 (0)