@@ -1,4 +1,4 @@
1−module Yoga.Fetch.Om.ClientFn
1+module Yoga.Fetch.Om.ClientFunction
22 ( class BuildClientFn
33 , buildClientFn
44 , class CheckBodyIsUnit
@@ -10,7 +10,6 @@ import Data.Unit (Unit, unit)
1010import Prim.RowList (RowList)
1111import Prim.RowList as RL
1212import Type.Proxy (Proxy)
13−import Unsafe.Coerce (unsafeCoerce)
1413import Yoga.Om (Om)
1514
1615data IsUnit
@@ -26,7 +25,9 @@ class BuildClientFn
2625 :: RowList Type -> RowList Type -> Type -> Type -> Row Type -> Row Type -> Row Type -> Type -> Type -> Constraint
2726class
2827 BuildClientFn pathQueryRL headersRL bodyFlag body pathQuery headers errorRow result fn
29− | pathQueryRL headersRL bodyFlag body pathQuery headers errorRow result -> fn where
28+ | pathQueryRL -> pathQuery
29+ , headersRL -> headers
30+ , pathQueryRL headersRL bodyFlag body errorRow result -> fn where
3031 buildClientFn
3132 :: Proxy pathQueryRL
3233 -> Proxy headersRL
@@ -40,12 +41,12 @@ instance
4041 RL.Nil
4142 IsUnit
4243 Unit
43− pq
44− h
44+ ()
45+ ()
4546 errorRow
4647 result
4748 (Om (Record ()) errorRow result) where
48− buildClientFn _ _ _ f = unsafeCoerce (f (unsafeCoerce {}) (unsafeCoerce {}) unit)
49+ buildClientFn _ _ _ f = f {} {} unit
4950
5051-- No path/query, no headers, with body
5152instance
@@ -53,12 +54,12 @@ instance
5354 RL.Nil
5455 IsNotUnit
5556 body
56− pq
57− h
57+ ()
58+ ()
5859 errorRow
5960 result
6061 (body -> Om (Record ()) errorRow result) where
61− buildClientFn _ _ _ f = unsafeCoerce (\b -> f (unsafeCoerce {}) (unsafeCoerce {}) b)
62+ buildClientFn _ _ _ f b = f {} {} b
6263
6364-- No path/query, with headers, no body
6465instance
@@ -66,12 +67,12 @@ instance
6667 (RL.Cons n t tl)
6768 IsUnit
6869 Unit
69− pq
70+ ()
7071 h
7172 errorRow
7273 result
7374 (Record h -> Om (Record ()) errorRow result) where
74− buildClientFn _ _ _ f = unsafeCoerce (\hdrs -> f (unsafeCoerce {}) hdrs unit)
75+ buildClientFn _ _ _ f hdrs = f {} hdrs unit
7576
7677-- No path/query, with headers, with body
7778instance
@@ -79,12 +80,12 @@ instance
7980 (RL.Cons n t tl)
8081 IsNotUnit
8182 body
82− pq
83+ ()
8384 h
8485 errorRow
8586 result
8687 (Record h -> body -> Om (Record ()) errorRow result) where
87− buildClientFn _ _ _ f = unsafeCoerce (\hdrs b -> f (unsafeCoerce {}) hdrs b)
88+ buildClientFn _ _ _ f hdrs b = f {} hdrs b
8889
8990-- With path/query, no headers, no body
9091instance
@@ -93,11 +94,11 @@ instance
9394 IsUnit
9495 Unit
9596 pq
96− h
97+ ()
9798 errorRow
9899 result
99100 (Record pq -> Om (Record ()) errorRow result) where
100− buildClientFn _ _ _ f = unsafeCoerce (\pqr -> f pqr (unsafeCoerce {}) unit)
101+ buildClientFn _ _ _ f pqr = f pqr {} unit
101102
102103-- With path/query, no headers, with body
103104instance
@@ -106,11 +107,11 @@ instance
106107 IsNotUnit
107108 body
108109 pq
109− h
110+ ()
110111 errorRow
111112 result
112113 (Record pq -> body -> Om (Record ()) errorRow result) where
113− buildClientFn _ _ _ f = unsafeCoerce (\pqr b -> f pqr (unsafeCoerce {}) b)
114+ buildClientFn _ _ _ f pqr b = f pqr {} b
114115
115116-- With path/query, with headers, no body
116117instance
@@ -123,7 +124,7 @@ instance
123124 errorRow
124125 result
125126 (Record pq -> Record h -> Om (Record ()) errorRow result) where
126− buildClientFn _ _ _ f = unsafeCoerce (\pqr hdrs -> f pqr hdrs unit)
127+ buildClientFn _ _ _ f pqr hdrs = f pqr hdrs unit
127128
128129-- With path/query, with headers, with body
129130instance
@@ -136,4 +137,4 @@ instance
136137 errorRow
137138 result
138139 (Record pq -> Record h -> body -> Om (Record ()) errorRow result) where
139− buildClientFn _ _ _ f = unsafeCoerce f
140+ buildClientFn _ _ _ f = f