Skip to content

Commit b40025a

Browse files
Update to PureScript v0.15.0 (#39)
* ESM conversion * ES6 transformations * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update Bower dependencies to master or main * Update pulp to 16.0.0-0 * Update psa to 0.8.2 * Update Bower dependencies to master or main * Update ci.yml to v2 * Add changelog entry Co-authored-by: Nicholas Wolverson <nicholas.wolverson@gmail.com>
1 parent facc272 commit b40025a

File tree

6 files changed

+145
-214
lines changed

6 files changed

+145
-214
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
- uses: actions/checkout@v2
1414

1515
- uses: purescript-contrib/setup-purescript@main
16+
with:
17+
purescript: "unstable"
1618

17-
- uses: actions/setup-node@v1
19+
- uses: actions/setup-node@v2
1820
with:
19-
node-version: "10"
21+
node-version: "14"
2022

2123
- name: Install dependencies
2224
run: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
55
## [Unreleased]
66

77
Breaking changes:
8+
- Update project and deps to PureScript v0.15.0 (#39 by @nwolverson, @JordanMartinez, @sigma-andex)
89

910
New features:
1011

bower.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"url": "https://github.com/purescript-node/purescript-node-streams.git"
1313
},
1414
"devDependencies": {
15-
"purescript-assert": "^5.0.0",
16-
"purescript-console": "^5.0.0",
17-
"purescript-partial": "^3.0.0"
15+
"purescript-assert": "master",
16+
"purescript-console": "master",
17+
"purescript-partial": "master"
1818
},
1919
"dependencies": {
20-
"purescript-effect": "^3.0.0",
21-
"purescript-either": "^5.0.0",
22-
"purescript-exceptions": "^5.0.0",
23-
"purescript-node-buffer": "^7.0.0",
24-
"purescript-prelude": "^5.0.0"
20+
"purescript-effect": "master",
21+
"purescript-either": "master",
22+
"purescript-exceptions": "master",
23+
"purescript-node-buffer": "master",
24+
"purescript-prelude": "master"
2525
}
2626
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
},
1010
"devDependencies": {
1111
"eslint": "^7.15.0",
12-
"pulp": "^15.0.0",
13-
"purescript-psa": "^0.8.0",
12+
"pulp": "16.0.0-0",
13+
"purescript-psa": "^0.8.2",
1414
"rimraf": "^3.0.2",
1515
"stream-buffers": "^3.0.2"
1616
}

src/Node/Stream.js

Lines changed: 111 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,208 +1,145 @@
1-
"use strict";
1+
const _undefined = undefined;
2+
export { _undefined as undefined };
23

3-
exports.undefined = undefined;
4-
5-
exports.setEncodingImpl = function (s) {
6-
return function (enc) {
7-
return function () {
8-
s.setEncoding(enc);
9-
};
4+
export function setEncodingImpl(s) {
5+
return enc => () => {
6+
s.setEncoding(enc);
107
};
11-
};
12-
13-
exports.readChunkImpl = function (Left) {
14-
return function (Right) {
15-
return function (chunk) {
16-
if (chunk instanceof Buffer) {
17-
return Right(chunk);
18-
} else if (typeof chunk === "string") {
19-
return Left(chunk);
20-
} else {
21-
throw new Error(
22-
"Node.Stream.readChunkImpl: Unrecognised " +
23-
"chunk type; expected String or Buffer, got: " +
24-
chunk
25-
);
26-
}
27-
};
8+
}
9+
10+
export function readChunkImpl(Left) {
11+
return Right => chunk => {
12+
if (chunk instanceof Buffer) {
13+
return Right(chunk);
14+
} else if (typeof chunk === "string") {
15+
return Left(chunk);
16+
} else {
17+
throw new Error(
18+
"Node.Stream.readChunkImpl: Unrecognised " +
19+
"chunk type; expected String or Buffer, got: " +
20+
chunk
21+
);
22+
}
2823
};
29-
};
30-
31-
exports.onDataEitherImpl = function (readChunk) {
32-
return function (r) {
33-
return function (f) {
34-
return function () {
35-
r.on("data", function (data) {
36-
f(readChunk(data))();
37-
});
38-
};
39-
};
24+
}
25+
26+
export function onDataEitherImpl(readChunk) {
27+
return r => f => () => {
28+
r.on("data", data => {
29+
f(readChunk(data))();
30+
});
4031
};
41-
};
32+
}
4233

43-
exports.onEnd = function (s) {
44-
return function (f) {
45-
return function () {
46-
s.on("end", f);
47-
};
34+
export function onEnd(s) {
35+
return f => () => {
36+
s.on("end", f);
4837
};
49-
};
38+
}
5039

51-
exports.onFinish = function (s) {
52-
return function (f) {
53-
return function () {
54-
s.on("finish", f);
55-
};
40+
export function onFinish(s) {
41+
return f => () => {
42+
s.on("finish", f);
5643
};
57-
};
44+
}
5845

59-
exports.onReadable = function (s) {
60-
return function (f) {
61-
return function () {
62-
s.on("readable", f);
63-
};
46+
export function onReadable(s) {
47+
return f => () => {
48+
s.on("readable", f);
6449
};
65-
};
66-
67-
exports.onError = function (s) {
68-
return function (f) {
69-
return function () {
70-
s.on("error", function (e) {
71-
f(e)();
72-
});
73-
};
50+
}
51+
52+
export function onError(s) {
53+
return f => () => {
54+
s.on("error", e => {
55+
f(e)();
56+
});
7457
};
75-
};
58+
}
7659

77-
exports.onClose = function (s) {
78-
return function (f) {
79-
return function () {
80-
s.on("close", f);
81-
};
60+
export function onClose(s) {
61+
return f => () => {
62+
s.on("close", f);
8263
};
83-
};
64+
}
8465

85-
exports.resume = function (s) {
86-
return function () {
66+
export function resume(s) {
67+
return () => {
8768
s.resume();
8869
};
89-
};
70+
}
9071

91-
exports.pause = function (s) {
92-
return function () {
72+
export function pause(s) {
73+
return () => {
9374
s.pause();
9475
};
95-
};
76+
}
9677

97-
exports.isPaused = function (s) {
98-
return function () {
99-
return s.isPaused();
100-
};
101-
};
78+
export function isPaused(s) {
79+
return () => s.isPaused();
80+
}
10281

103-
exports.pipe = function (r) {
104-
return function (w) {
105-
return function () {
106-
return r.pipe(w);
107-
};
108-
};
109-
};
82+
export function pipe(r) {
83+
return w => () => r.pipe(w);
84+
}
11085

111-
exports.unpipe = function (r) {
112-
return function (w) {
113-
return function () {
114-
return r.unpipe(w);
115-
};
116-
};
117-
};
86+
export function unpipe(r) {
87+
return w => () => r.unpipe(w);
88+
}
11889

119-
exports.unpipeAll = function (r) {
120-
return function () {
121-
return r.unpipe();
122-
};
123-
};
124-
125-
exports.readImpl = function (readChunk) {
126-
return function (Nothing) {
127-
return function (Just) {
128-
return function (r) {
129-
return function (s) {
130-
return function () {
131-
var v = r.read(s);
132-
if (v === null) {
133-
return Nothing;
134-
} else {
135-
return Just(readChunk(v));
136-
}
137-
};
138-
};
139-
};
140-
};
141-
};
142-
};
143-
144-
exports.write = function (w) {
145-
return function (chunk) {
146-
return function (done) {
147-
return function () {
148-
return w.write(chunk, null, done);
149-
};
150-
};
151-
};
152-
};
153-
154-
exports.writeStringImpl = function (w) {
155-
return function (enc) {
156-
return function (s) {
157-
return function (done) {
158-
return function () {
159-
return w.write(s, enc, done);
160-
};
161-
};
162-
};
163-
};
164-
};
90+
export function unpipeAll(r) {
91+
return () => r.unpipe();
92+
}
16593

166-
exports.cork = function (w) {
167-
return function () {
168-
return w.cork();
94+
export function readImpl(readChunk) {
95+
return Nothing => Just => r => s => () => {
96+
const v = r.read(s);
97+
if (v === null) {
98+
return Nothing;
99+
} else {
100+
return Just(readChunk(v));
101+
}
169102
};
170-
};
103+
}
171104

172-
exports.uncork = function (w) {
173-
return function () {
174-
return w.uncork();
175-
};
176-
};
105+
export function write(w) {
106+
return chunk => done => () => w.write(chunk, null, done);
107+
}
177108

178-
exports.setDefaultEncodingImpl = function (w) {
179-
return function (enc) {
180-
return function () {
181-
w.setDefaultEncoding(enc);
182-
};
109+
export function writeStringImpl(w) {
110+
return enc => s => done => () => w.write(s, enc, done);
111+
}
112+
113+
export function cork(w) {
114+
return () => w.cork();
115+
}
116+
117+
export function uncork(w) {
118+
return () => w.uncork();
119+
}
120+
121+
export function setDefaultEncodingImpl(w) {
122+
return enc => () => {
123+
w.setDefaultEncoding(enc);
183124
};
184-
};
185-
186-
exports.end = function (w) {
187-
return function (done) {
188-
return function () {
189-
w.end(null, null, function () {
190-
done();
191-
});
192-
};
125+
}
126+
127+
export function end(w) {
128+
return done => () => {
129+
w.end(null, null, () => {
130+
done();
131+
});
193132
};
194-
};
133+
}
195134

196-
exports.destroy = function (strm) {
197-
return function () {
135+
export function destroy(strm) {
136+
return () => {
198137
strm.destroy(null);
199138
};
200-
};
139+
}
201140

202-
exports.destroyWithError = function (strm) {
203-
return function (e) {
204-
return function () {
205-
strm.destroy(e);
206-
};
141+
export function destroyWithError(strm) {
142+
return e => () => {
143+
strm.destroy(e);
207144
};
208-
};
145+
}

0 commit comments

Comments
 (0)