Skip to content

Commit 03abc1e

Browse files
Update to v0.15.0 (#81)
* Migrated FFI to ES modules via 'lebab' * Removed '"use strict";' in FFI files * Update to CI to use 'unstable' purescript * Update pulp to 16.0.0-0 and psa to 0.8.2 * Update Bower dependencies to master * Update .eslintrc.json to ES6 * Remove forall proxy workaround * Added changelog entry * Update CHANGELOG.md Co-authored-by: Thomas Honeyman <hello@thomashoneyman.com> Co-authored-by: Thomas Honeyman <hello@thomashoneyman.com>
1 parent 091495d commit 03abc1e

File tree

9 files changed

+48
-49
lines changed

9 files changed

+48
-49
lines changed

.eslintrc.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{
22
"parserOptions": {
3-
"ecmaVersion": 5
3+
"ecmaVersion": 6,
4+
"sourceType": "module"
45
},
56
"extends": "eslint:recommended",
6-
"env": {
7-
"commonjs": true
8-
},
97
"rules": {
108
"strict": [2, "global"],
119
"block-scoped-var": 2,

.github/workflows/ci.yml

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

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

1719
- uses: actions/setup-node@v1
1820
with:

CHANGELOG.md

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

77
Breaking changes:
8+
- Migrate FFI to ES modules (#81 by @kl0tl and @JordanMartinez)
9+
- Replaced polymorphic proxies with monomorphic `Proxy` (#81 by @JordanMartinez)
810

911
New features:
1012

bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"package.json"
1818
],
1919
"dependencies": {
20-
"purescript-functions": "^5.0.0",
21-
"purescript-prelude": "^5.0.0",
22-
"purescript-unsafe-coerce": "^5.0.0"
20+
"purescript-functions": "master",
21+
"purescript-prelude": "master",
22+
"purescript-unsafe-coerce": "master"
2323
},
2424
"devDependencies": {
25-
"purescript-assert": "^5.0.0"
25+
"purescript-assert": "master"
2626
}
2727
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
},
88
"devDependencies": {
99
"eslint": "^7.15.0",
10-
"purescript-psa": "^0.8.0",
11-
"pulp": "^15.0.0",
10+
"purescript-psa": "^0.8.2",
11+
"pulp": "16.0.0-0",
1212
"rimraf": "^3.0.2"
1313
}
1414
}

src/Record.purs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ import Unsafe.Coerce (unsafeCoerce)
3434
-- | get (Proxy :: Proxy "x") :: forall r a. { x :: a | r } -> a
3535
-- | ```
3636
get
37-
:: forall proxy r r' l a
37+
:: forall r r' l a
3838
. IsSymbol l
3939
=> Cons l a r' r
40-
=> proxy l
40+
=> Proxy l
4141
-> Record r
4242
-> a
4343
get l r = unsafeGet (reflectSymbol l) r
@@ -52,11 +52,11 @@ get l r = unsafeGet (reflectSymbol l) r
5252
-- | :: forall r a b. a -> { x :: b | r } -> { x :: a | r }
5353
-- | ```
5454
set
55-
:: forall proxy r1 r2 r l a b
55+
:: forall r1 r2 r l a b
5656
. IsSymbol l
5757
=> Cons l a r r1
5858
=> Cons l b r r2
59-
=> proxy l
59+
=> Proxy l
6060
-> b
6161
-> Record r1
6262
-> Record r2
@@ -72,11 +72,11 @@ set l b r = unsafeSet (reflectSymbol l) b r
7272
-- | :: forall r a b. (a -> b) -> { x :: a | r } -> { x :: b | r }
7373
-- | ```
7474
modify
75-
:: forall proxy r1 r2 r l a b
75+
:: forall r1 r2 r l a b
7676
. IsSymbol l
7777
=> Cons l a r r1
7878
=> Cons l b r r2
79-
=> proxy l
79+
=> Proxy l
8080
-> (a -> b)
8181
-> Record r1
8282
-> Record r2
@@ -92,11 +92,11 @@ modify l f r = set l (f (get l r)) r
9292
-- | :: forall r a. Lacks "x" r => a -> { | r } -> { x :: a | r }
9393
-- | ```
9494
insert
95-
:: forall proxy r1 r2 l a
95+
:: forall r1 r2 l a
9696
. IsSymbol l
9797
=> Lacks l r1
9898
=> Cons l a r1 r2
99-
=> proxy l
99+
=> Proxy l
100100
-> a
101101
-> Record r1
102102
-> Record r2
@@ -115,11 +115,11 @@ insert l a r = unsafeSet (reflectSymbol l) a r
115115
-- | :: forall r a. Lacks "x" r => { x :: a | r } -> { | r }
116116
-- | ```
117117
delete
118-
:: forall proxy r1 r2 l a
118+
:: forall r1 r2 l a
119119
. IsSymbol l
120120
=> Lacks l r1
121121
=> Cons l a r1 r2
122-
=> proxy l
122+
=> Proxy l
123123
-> Record r2
124124
-> Record r1
125125
delete l r = unsafeDelete (reflectSymbol l) r
@@ -136,15 +136,15 @@ delete l r = unsafeDelete (reflectSymbol l) r
136136
-- | rename (Proxy :: Proxy "x") (Proxy :: Proxy "y")
137137
-- | :: forall a r. Lacks "x" r => Lacks "y" r => { x :: a | r} -> { y :: a | r}
138138
-- | ```
139-
rename :: forall proxy prev next ty input inter output
139+
rename :: forall prev next ty input inter output
140140
. IsSymbol prev
141141
=> IsSymbol next
142142
=> Cons prev ty inter input
143143
=> Lacks prev inter
144144
=> Cons next ty inter output
145145
=> Lacks next inter
146-
=> proxy prev
147-
-> proxy next
146+
=> Proxy prev
147+
-> Proxy next
148148
-> Record input
149149
-> Record output
150150
rename prev next record =
@@ -224,7 +224,7 @@ equal
224224
equal a b = equalFields (Proxy :: Proxy rs) a b
225225

226226
class EqualFields (rs :: RowList Type) (row :: Row Type) | rs -> row where
227-
equalFields :: forall rlproxy. rlproxy rs -> Record row -> Record row -> Boolean
227+
equalFields :: Proxy rs -> Record row -> Record row -> Boolean
228228

229229
instance equalFieldsCons
230230
::

src/Record/Builder.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
"use strict";
2-
3-
exports.copyRecord = function(rec) {
1+
export function copyRecord(rec) {
42
var copy = {};
53
for (var key in rec) {
64
if ({}.hasOwnProperty.call(rec, key)) {
75
copy[key] = rec[key];
86
}
97
}
108
return copy;
11-
};
9+
}
1210

13-
exports.unsafeInsert = function(l) {
11+
export function unsafeInsert(l) {
1412
return function(a) {
1513
return function(rec) {
1614
rec[l] = a;
1715
return rec;
1816
};
1917
};
20-
};
18+
}
2119

22-
exports.unsafeModify = function(l) {
20+
export function unsafeModify(l) {
2321
return function (f) {
2422
return function(rec) {
2523
rec[l] = f(rec[l]);
2624
return rec;
2725
};
2826
};
29-
};
27+
}
3028

31-
exports.unsafeDelete = function(l) {
29+
export function unsafeDelete(l) {
3230
return function(rec) {
3331
delete rec[l];
3432
return rec;
3533
};
36-
};
34+
}
3735

38-
exports.unsafeRename = function(l1) {
36+
export function unsafeRename(l1) {
3937
return function (l2) {
4038
return function (rec) {
4139
rec[l2] = rec[l1];
4240
delete rec[l1];
4341
return rec;
4442
};
4543
};
46-
};
44+
}

src/Record/Builder.purs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Data.Function.Uncurried (runFn2)
2020
import Data.Symbol (class IsSymbol, reflectSymbol)
2121
import Prim.Row as Row
2222
import Record.Unsafe.Union (unsafeUnionFn)
23+
import Type.Proxy (Proxy)
2324
import Unsafe.Coerce (unsafeCoerce)
2425

2526
foreign import copyRecord :: forall r1. Record r1 -> Record r1
@@ -61,46 +62,46 @@ derive newtype instance categoryBuilder :: Category Builder
6162

6263
-- | Build by inserting a new field.
6364
insert
64-
:: forall proxy l a r1 r2
65+
:: forall l a r1 r2
6566
. Row.Cons l a r1 r2
6667
=> Row.Lacks l r1
6768
=> IsSymbol l
68-
=> proxy l
69+
=> Proxy l
6970
-> a
7071
-> Builder (Record r1) (Record r2)
7172
insert l a = Builder \r1 -> unsafeInsert (reflectSymbol l) a r1
7273

7374
-- | Build by modifying an existing field.
7475
modify
75-
:: forall proxy l a b r r1 r2
76+
:: forall l a b r r1 r2
7677
. Row.Cons l a r r1
7778
=> Row.Cons l b r r2
7879
=> IsSymbol l
79-
=> proxy l
80+
=> Proxy l
8081
-> (a -> b)
8182
-> Builder (Record r1) (Record r2)
8283
modify l f = Builder \r1 -> unsafeModify (reflectSymbol l) f r1
8384

8485
-- | Build by deleting an existing field.
8586
delete
86-
:: forall proxy l a r1 r2
87+
:: forall l a r1 r2
8788
. IsSymbol l
8889
=> Row.Lacks l r1
8990
=> Row.Cons l a r1 r2
90-
=> proxy l
91+
=> Proxy l
9192
-> Builder (Record r2) (Record r1)
9293
delete l = Builder \r2 -> unsafeDelete (reflectSymbol l) r2
9394

9495
-- | Build by renaming an existing field.
95-
rename :: forall proxy l1 l2 a r1 r2 r3
96+
rename :: forall l1 l2 a r1 r2 r3
9697
. IsSymbol l1
9798
=> IsSymbol l2
9899
=> Row.Cons l1 a r2 r1
99100
=> Row.Lacks l1 r2
100101
=> Row.Cons l2 a r2 r3
101102
=> Row.Lacks l2 r2
102-
=> proxy l1
103-
-> proxy l2
103+
=> Proxy l1
104+
-> Proxy l2
104105
-> Builder (Record r1) (Record r3)
105106
rename l1 l2 = Builder \r1 -> unsafeRename (reflectSymbol l1) (reflectSymbol l2) r1
106107

src/Record/Unsafe/Union.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"use strict";
2-
3-
exports.unsafeUnionFn = function(r1, r2) {
1+
export function unsafeUnionFn(r1, r2) {
42
var copy = {};
53
for (var k1 in r2) {
64
if ({}.hasOwnProperty.call(r2, k1)) {
@@ -13,4 +11,4 @@ exports.unsafeUnionFn = function(r1, r2) {
1311
}
1412
}
1513
return copy;
16-
};
14+
}

0 commit comments

Comments
 (0)