Skip to content

Commit 8e9f3c9

Browse files
committed
Merge branch 'compiler/0.12' into st-modify
2 parents 3326f47 + a771398 commit 8e9f3c9

File tree

11 files changed

+175
-227
lines changed

11 files changed

+175
-227
lines changed

bower.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
"package.json"
1818
],
1919
"dependencies": {
20-
"purescript-symbols": "^3.0.0",
21-
"purescript-functions": "^3.0.0",
22-
"purescript-typelevel-prelude": "^2.3.1",
23-
"purescript-st": "^3.0.0"
20+
"purescript-functions": "#compiler/0.12",
21+
"purescript-typelevel-prelude": "#compiler/0.12",
22+
"purescript-st": "#compiler/0.12"
2423
},
2524
"devDependencies": {
26-
"purescript-assert": "^3.0.0"
25+
"purescript-assert": "#compiler/0.12"
2726
}
2827
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
55
"build": "eslint src && pulp build -- --censor-lib --strict",
6-
"test": "pulp test"
6+
"test": "pulp test --check-main-type Effect.Effect"
77
},
88
"devDependencies": {
9-
"eslint": "^3.17.1",
10-
"purescript-psa": "^0.5.0",
11-
"pulp": "^11.0.0",
12-
"rimraf": "^2.6.1"
9+
"eslint": "^4.19.1",
10+
"purescript-psa": "^0.6.0",
11+
"pulp": "^12.0.1",
12+
"rimraf": "^2.6.2"
1313
}
1414
}

src/Data/Record/ST.purs

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

src/Data/Record/Unsafe.js

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

src/Data/Record/Unsafe.purs

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

src/Data/Record.purs renamed to src/Record.purs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module Data.Record
1+
module Record
22
( get
33
, set
44
, modify
@@ -10,11 +10,11 @@ module Data.Record
1010
, equalFields
1111
) where
1212

13-
import Data.Function.Uncurried (runFn2, runFn3)
14-
import Data.Record.Unsafe (unsafeGetFn, unsafeSetFn, unsafeDeleteFn)
13+
import Prelude
14+
1515
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
16-
import Prelude (class Eq, (&&), (==))
17-
import Type.Row (class RowLacks, class RowToList, Cons, Nil, RLProxy(RLProxy), kind RowList)
16+
import Record.Unsafe (unsafeDelete, unsafeGet, unsafeSet)
17+
import Type.Row (class Lacks, class Cons, class RowToList, Cons, Nil, RLProxy(RLProxy), kind RowList)
1818

1919
-- | Get a property for a label which is specified using a value-level proxy for
2020
-- | a type-level string.
@@ -27,11 +27,11 @@ import Type.Row (class RowLacks, class RowToList, Cons, Nil, RLProxy(RLProxy), k
2727
get
2828
:: forall r r' l a
2929
. IsSymbol l
30-
=> RowCons l a r' r
30+
=> Cons l a r' r
3131
=> SProxy l
3232
-> Record r
3333
-> a
34-
get l r = runFn2 unsafeGetFn (reflectSymbol l) r
34+
get l r = unsafeGet (reflectSymbol l) r
3535

3636
-- | Set a property for a label which is specified using a value-level proxy for
3737
-- | a type-level string.
@@ -45,13 +45,13 @@ get l r = runFn2 unsafeGetFn (reflectSymbol l) r
4545
set
4646
:: forall r1 r2 r l a b
4747
. IsSymbol l
48-
=> RowCons l a r r1
49-
=> RowCons l b r r2
48+
=> Cons l a r r1
49+
=> Cons l b r r2
5050
=> SProxy l
5151
-> b
5252
-> Record r1
5353
-> Record r2
54-
set l b r = runFn3 unsafeSetFn (reflectSymbol l) b r
54+
set l b r = unsafeSet (reflectSymbol l) b r
5555

5656
-- | Modify a property for a label which is specified using a value-level proxy for
5757
-- | a type-level string.
@@ -65,8 +65,8 @@ set l b r = runFn3 unsafeSetFn (reflectSymbol l) b r
6565
modify
6666
:: forall r1 r2 r l a b
6767
. IsSymbol l
68-
=> RowCons l a r r1
69-
=> RowCons l b r r2
68+
=> Cons l a r r1
69+
=> Cons l b r r2
7070
=> SProxy l
7171
-> (a -> b)
7272
-> Record r1
@@ -80,18 +80,18 @@ modify l f r = set l (f (get l r)) r
8080
-- |
8181
-- | ```purescript
8282
-- | insert (SProxy :: SProxy "x")
83-
-- | :: forall r a. RowLacks "x" r => a -> { | r } -> { x :: a | r }
83+
-- | :: forall r a. Lacks "x" r => a -> { | r } -> { x :: a | r }
8484
-- | ```
8585
insert
8686
:: forall r1 r2 l a
8787
. IsSymbol l
88-
=> RowLacks l r1
89-
=> RowCons l a r1 r2
88+
=> Lacks l r1
89+
=> Cons l a r1 r2
9090
=> SProxy l
9191
-> a
9292
-> Record r1
9393
-> Record r2
94-
insert l a r = runFn3 unsafeSetFn (reflectSymbol l) a r
94+
insert l a r = unsafeSet (reflectSymbol l) a r
9595

9696
-- | Delete a property for a label which is specified using a value-level proxy for
9797
-- | a type-level string.
@@ -103,17 +103,17 @@ insert l a r = runFn3 unsafeSetFn (reflectSymbol l) a r
103103
-- |
104104
-- | ```purescript
105105
-- | delete (SProxy :: SProxy "x")
106-
-- | :: forall r a. RowLacks "x" r => { x :: a | r } -> { | r }
106+
-- | :: forall r a. Lacks "x" r => { x :: a | r } -> { | r }
107107
-- | ```
108108
delete
109109
:: forall r1 r2 l a
110110
. IsSymbol l
111-
=> RowLacks l r1
112-
=> RowCons l a r1 r2
111+
=> Lacks l r1
112+
=> Cons l a r1 r2
113113
=> SProxy l
114114
-> Record r2
115115
-> Record r1
116-
delete l r = runFn2 unsafeDeleteFn (reflectSymbol l) r
116+
delete l r = unsafeDelete (reflectSymbol l) r
117117

118118
-- | Rename a property for a label which is specified using a value-level proxy for
119119
-- | a type-level string.
@@ -125,15 +125,15 @@ delete l r = runFn2 unsafeDeleteFn (reflectSymbol l) r
125125
-- |
126126
-- | ```purescript
127127
-- | rename (SProxy :: SProxy "x") (SProxy :: SProxy "y")
128-
-- | :: forall a r. RowLacks "x" r => RowLacks "y" r => { x :: a | r} -> { y :: a | r}
128+
-- | :: forall a r. Lacks "x" r => Lacks "y" r => { x :: a | r} -> { y :: a | r}
129129
-- | ```
130130
rename :: forall prev next ty input inter output
131131
. IsSymbol prev
132132
=> IsSymbol next
133-
=> RowCons prev ty inter input
134-
=> RowLacks prev inter
135-
=> RowCons next ty inter output
136-
=> RowLacks next inter
133+
=> Cons prev ty inter input
134+
=> Lacks prev inter
135+
=> Cons next ty inter output
136+
=> Lacks next inter
137137
=> SProxy prev
138138
-> SProxy next
139139
-> Record input
@@ -158,7 +158,7 @@ instance equalFieldsCons
158158
::
159159
( IsSymbol name
160160
, Eq ty
161-
, RowCons name ty tailRow row
161+
, Cons name ty tailRow row
162162
, EqualFields tail row
163163
) => EqualFields (Cons name ty tail) row where
164164
equalFields _ a b = get' a == get' b && equalRest a b

src/Data/Record/Builder.js renamed to src/Record/Builder.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ exports.unsafeInsert = function(l) {
1919
};
2020
};
2121

22+
exports.unsafeModify = function(l) {
23+
return function (f) {
24+
return function(rec) {
25+
rec[l] = f(rec[l]);
26+
return rec;
27+
};
28+
};
29+
};
30+
2231
exports.unsafeDelete = function(l) {
2332
return function(rec) {
2433
delete rec[l];

0 commit comments

Comments
 (0)