Skip to content

Commit 0e5d81b

Browse files
committed
Remove Action type
1 parent 90e61f0 commit 0e5d81b

File tree

1 file changed

+21
-27
lines changed

1 file changed

+21
-27
lines changed

src/React/Hooks.purs

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ module React.Hooks
1616
, useReducerLazy
1717
, dispatch
1818
, Dispatch
19-
, Action_
20-
, Action
2119

2220
, useCallback
2321
, callbackInput
@@ -137,50 +135,46 @@ foreign import useContext_
137135
a
138136

139137
useReducer
140-
:: forall r a
141-
. (a -> Action r -> a)
138+
:: forall a b
139+
. (a -> b -> a)
142140
-> a
143-
-> Effect (Tuple a (Dispatch (Action r)))
141+
-> Effect (Tuple a (Dispatch a b))
144142
useReducer = runEffectFn3 useReducer_ Tuple <<< mkFn2
145143

146144
useReducerLazy
147-
:: forall r a
148-
. (a -> Action r -> a)
145+
:: forall a b
146+
. (a -> b -> a)
149147
-> a
150-
-> Action r
151-
-> Effect (Tuple a (Dispatch (Action r)))
148+
-> b
149+
-> Effect (Tuple a (Dispatch a b))
152150
useReducerLazy = runEffectFn4 useReducerLazy_ Tuple <<< mkFn2
153151

154152
dispatch
155-
:: forall r
156-
. Dispatch (Action r)
157-
-> Action r
153+
:: forall a b
154+
. Dispatch a b
155+
-> a
158156
-> Effect Unit
159157
dispatch k = runEffectFn1 k'
160158
where
161-
k' :: EffectFn1 (Action r) Unit
159+
k' :: EffectFn1 a Unit
162160
k' = unsafeCoerce k
163161

164-
foreign import data Dispatch :: Type -> Type
165-
166-
foreign import data Action_ :: # Type -> Type
167-
168-
type Action r = Action_ ( type :: String | r )
162+
foreign import data Dispatch :: Type -> Type -> Type
169163

170164
foreign import useReducer_
171-
:: forall r a
172-
. EffectFn3 (a -> Dispatch (Action r) -> Tuple a (Dispatch (Action r)))
173-
(Fn2 a (Action r) a)
165+
:: forall a b
166+
. EffectFn3 (a -> Dispatch a b -> Tuple a (Dispatch a b))
167+
(Fn2 a b a)
174168
a
175-
(Tuple a (Dispatch (Action r)))
169+
(Tuple a (Dispatch a b))
176170

177171
foreign import useReducerLazy_
178-
:: forall r a
179-
. EffectFn4 (a -> Dispatch (Action r) -> Tuple a (Dispatch (Action r)))
180-
(Fn2 a (Action r) a)
172+
:: forall a b
173+
. EffectFn4 (a -> Dispatch a b -> Tuple a (Dispatch a b))
174+
(Fn2 a b a)
181175
a
182-
(Action r)
183-
(Tuple a (Dispatch (Action r)))
176+
b
177+
(Tuple a (Dispatch a b))
184178

185179
useCallback
186180
:: forall a b

0 commit comments

Comments
 (0)