@@ -20,6 +20,14 @@ module React
20
20
, Refs ()
21
21
22
22
, Render ()
23
+ , GetInitialState ()
24
+ , ComponentWillMount ()
25
+ , ComponentDidMount ()
26
+ , ComponentWillReceiveProps ()
27
+ , ShouldComponentUpdate ()
28
+ , ComponentWillUpdate ()
29
+ , ComponentDidUpdate ()
30
+ , ComponentWillUnmount ()
23
31
24
32
, ReactSpec ()
25
33
, ReactClass ()
@@ -134,7 +142,7 @@ type EventHandlerContext eff props state result =
134
142
| eff
135
143
) result
136
144
137
- -- | A rendering function.
145
+ -- | A render function.
138
146
type Render props state eff =
139
147
ReactThis props state ->
140
148
Eff ( props :: ReactProps props
@@ -143,73 +151,97 @@ type Render props state eff =
143
151
| eff
144
152
) ReactElement
145
153
154
+ -- | A get initial state function.
155
+ type GetInitialState props state eff =
156
+ ReactThis props state ->
157
+ Eff ( props :: ReactProps props
158
+ , state :: ReactState Disallowed state
159
+ , refs :: ReactRefs Disallowed
160
+ | eff
161
+ ) state
162
+
163
+ -- | A component will mount function.
164
+ type ComponentWillMount props state eff =
165
+ ReactThis props state ->
166
+ Eff ( props :: ReactProps props
167
+ , state :: ReactState ReadWrite state
168
+ , refs :: ReactRefs Disallowed
169
+ | eff
170
+ ) Unit
171
+
172
+ -- | A component did mount function.
173
+ type ComponentDidMount props state eff =
174
+ ReactThis props state ->
175
+ Eff ( props :: ReactProps props
176
+ , state :: ReactState ReadWrite state
177
+ , refs :: ReactRefs ReadOnly
178
+ | eff
179
+ ) Unit
180
+
181
+ -- | A component will receive props function.
182
+ type ComponentWillReceiveProps props state eff =
183
+ ReactThis props state ->
184
+ props ->
185
+ Eff ( props :: ReactProps props
186
+ , state :: ReactState ReadWrite state
187
+ , refs :: ReactRefs ReadOnly
188
+ | eff
189
+ ) Unit
190
+
191
+ -- | A should component update function.
192
+ type ShouldComponentUpdate props state eff =
193
+ ReactThis props state ->
194
+ props ->
195
+ state ->
196
+ Eff ( props :: ReactProps props
197
+ , state :: ReactState ReadWrite state
198
+ , refs :: ReactRefs ReadOnly
199
+ | eff
200
+ ) Boolean
201
+
202
+ -- | A component will update function.
203
+ type ComponentWillUpdate props state eff =
204
+ ReactThis props state ->
205
+ props ->
206
+ state ->
207
+ Eff ( props :: ReactProps props
208
+ , state :: ReactState ReadWrite state
209
+ , refs :: ReactRefs ReadOnly
210
+ | eff
211
+ ) Unit
212
+
213
+ -- | A component did update function.
214
+ type ComponentDidUpdate props state eff =
215
+ ReactThis props state ->
216
+ props ->
217
+ state ->
218
+ Eff ( props :: ReactProps props
219
+ , state :: ReactState ReadOnly state
220
+ , refs :: ReactRefs ReadOnly
221
+ | eff
222
+ ) Unit
223
+
224
+ -- | A component will unmount function.
225
+ type ComponentWillUnmount props state eff =
226
+ ReactThis props state ->
227
+ Eff ( props :: ReactProps props
228
+ , state :: ReactState ReadOnly state
229
+ , refs :: ReactRefs ReadOnly
230
+ | eff
231
+ ) Unit
232
+
146
233
-- | A specification of a component.
147
234
type ReactSpec props state eff =
148
235
{ render :: Render props state eff
149
236
, displayName :: String
150
- , getInitialState
151
- :: ReactThis props state ->
152
- Eff ( props :: ReactProps props
153
- , state :: ReactState Disallowed state
154
- , refs :: ReactRefs Disallowed
155
- | eff
156
- ) state
157
- , componentWillMount
158
- :: ReactThis props state ->
159
- Eff ( props :: ReactProps props
160
- , state :: ReactState ReadWrite state
161
- , refs :: ReactRefs Disallowed
162
- | eff
163
- ) Unit
164
- , componentDidMount
165
- :: ReactThis props state ->
166
- Eff ( props :: ReactProps props
167
- , state :: ReactState ReadWrite state
168
- , refs :: ReactRefs ReadOnly
169
- | eff
170
- ) Unit
171
- , componentWillReceiveProps
172
- :: ReactThis props state ->
173
- props ->
174
- Eff ( props :: ReactProps props
175
- , state :: ReactState ReadWrite state
176
- , refs :: ReactRefs ReadOnly
177
- | eff
178
- ) Unit
179
- , shouldComponentUpdate
180
- :: ReactThis props state ->
181
- props ->
182
- state ->
183
- Eff ( props :: ReactProps props
184
- , state :: ReactState ReadWrite state
185
- , refs :: ReactRefs ReadOnly
186
- | eff
187
- ) Boolean
188
- , componentWillUpdate
189
- :: ReactThis props state ->
190
- props ->
191
- state ->
192
- Eff ( props :: ReactProps props
193
- , state :: ReactState ReadWrite state
194
- , refs :: ReactRefs ReadOnly
195
- | eff
196
- ) Unit
197
- , componentDidUpdate
198
- :: ReactThis props state ->
199
- props ->
200
- state ->
201
- Eff ( props :: ReactProps props
202
- , state :: ReactState ReadOnly state
203
- , refs :: ReactRefs ReadOnly
204
- | eff
205
- ) Unit
206
- , componentWillUnmount
207
- :: ReactThis props state ->
208
- Eff ( props :: ReactProps props
209
- , state :: ReactState ReadOnly state
210
- , refs :: ReactRefs ReadOnly
211
- | eff
212
- ) Unit
237
+ , getInitialState :: GetInitialState props state eff
238
+ , componentWillMount :: ComponentWillMount props state eff
239
+ , componentDidMount :: ComponentDidMount props state eff
240
+ , componentWillReceiveProps :: ComponentWillReceiveProps props state eff
241
+ , shouldComponentUpdate :: ShouldComponentUpdate props state eff
242
+ , componentWillUpdate :: ComponentWillUpdate props state eff
243
+ , componentDidUpdate :: ComponentDidUpdate props state eff
244
+ , componentWillUnmount :: ComponentWillUnmount props state eff
213
245
}
214
246
215
247
-- | Create a component specification.
0 commit comments