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+
1515import 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
2727get
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
4545set
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
6565modify
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-- | ```
8585insert
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-- | ```
108108delete
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-- | ```
130130rename :: 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
0 commit comments