@@ -10,8 +10,8 @@ module Node.ChildProcess
10
10
, kill
11
11
, send
12
12
, disconnect
13
- , ChildProcessError ()
14
- , ChildProcessExit (..)
13
+ , Error ()
14
+ , Exit (..)
15
15
, onExit
16
16
, onClose
17
17
, onDisconnect
@@ -119,11 +119,11 @@ mkEff = unsafeCoerce
119
119
120
120
-- | Specifies how a child process exited; normally (with an exit code), or
121
121
-- | due to a signal.
122
- data ChildProcessExit
122
+ data Exit
123
123
= Normally Int
124
124
| BySignal Signal
125
125
126
- instance showChildProcessExit :: Show ChildProcessExit where
126
+ instance showExit :: Show Exit where
127
127
show (Normally x) = " Normally " <> show x
128
128
show (BySignal sig) = " BySignal " <> show sig
129
129
@@ -136,28 +136,28 @@ type SpawnOptions =
136
136
, gid :: Maybe Int
137
137
}
138
138
139
- mkChildProcessExit :: Nullable Int -> Nullable String -> ChildProcessExit
140
- mkChildProcessExit code signal =
139
+ mkExit :: Nullable Int -> Nullable String -> Exit
140
+ mkExit code signal =
141
141
case fromCode code <|> fromSignal signal of
142
142
Just e -> e
143
- Nothing -> unsafeThrow " Node.ChildProcess.mkChildProcessExit : Invalid arguments"
143
+ Nothing -> unsafeThrow " Node.ChildProcess.mkExit : Invalid arguments"
144
144
where
145
145
fromCode = toMaybe >>> map Normally
146
146
fromSignal = toMaybe >=> Signal .fromString >>> map BySignal
147
147
148
- onExit :: forall eff . ChildProcess -> (ChildProcessExit -> Eff eff Unit ) -> Eff eff Unit
149
- onExit = mkOnExit mkChildProcessExit
148
+ onExit :: forall eff . ChildProcess -> (Exit -> Eff eff Unit ) -> Eff eff Unit
149
+ onExit = mkOnExit mkExit
150
150
151
151
foreign import mkOnExit :: forall eff .
152
- (Nullable Int -> Nullable String -> ChildProcessExit )
153
- -> ChildProcess -> (ChildProcessExit -> Eff eff Unit ) -> Eff eff Unit
152
+ (Nullable Int -> Nullable String -> Exit )
153
+ -> ChildProcess -> (Exit -> Eff eff Unit ) -> Eff eff Unit
154
154
155
- onClose :: forall eff . ChildProcess -> (ChildProcessExit -> Eff eff Unit ) -> Eff eff Unit
156
- onClose = mkOnClose mkChildProcessExit
155
+ onClose :: forall eff . ChildProcess -> (Exit -> Eff eff Unit ) -> Eff eff Unit
156
+ onClose = mkOnClose mkExit
157
157
158
158
foreign import mkOnClose :: forall eff .
159
- (Nullable Int -> Nullable String -> ChildProcessExit )
160
- -> ChildProcess -> (ChildProcessExit -> Eff eff Unit ) -> Eff eff Unit
159
+ (Nullable Int -> Nullable String -> Exit )
160
+ -> ChildProcess -> (Exit -> Eff eff Unit ) -> Eff eff Unit
161
161
162
162
onMessage :: forall eff . ChildProcess -> (Foreign -> Maybe Handle -> Eff eff Unit ) -> Eff eff Unit
163
163
onMessage = mkOnMessage Nothing Just
@@ -167,7 +167,7 @@ foreign import mkOnMessage :: forall a eff.
167
167
ChildProcess -> (Foreign -> Maybe Handle -> Eff eff Unit ) -> Eff eff Unit
168
168
169
169
foreign import onDisconnect :: forall eff . ChildProcess -> Eff eff Unit -> Eff eff Unit
170
- foreign import onError :: forall eff . ChildProcess -> (ChildProcessError -> Eff eff Unit ) -> Eff eff Unit
170
+ foreign import onError :: forall eff . ChildProcess -> (Error -> Eff eff Unit ) -> Eff eff Unit
171
171
172
172
-- | Spawn a child process. Note that, in the event that a child process could
173
173
-- | not be spawned (for example, if the executable was not found) this will
@@ -206,7 +206,7 @@ defaultSpawnOptions =
206
206
}
207
207
208
208
-- | An error which occurred inside a child process.
209
- type ChildProcessError =
209
+ type Error =
210
210
{ code :: String
211
211
, errno :: String
212
212
, syscall :: String
0 commit comments