@@ -10,8 +10,8 @@ module Node.ChildProcess
1010 , kill
1111 , send
1212 , disconnect
13- , ChildProcessError ()
14- , ChildProcessExit (..)
13+ , Error ()
14+ , Exit (..)
1515 , onExit
1616 , onClose
1717 , onDisconnect
@@ -119,11 +119,11 @@ mkEff = unsafeCoerce
119119
120120-- | Specifies how a child process exited; normally (with an exit code), or
121121-- | due to a signal.
122- data ChildProcessExit
122+ data Exit
123123 = Normally Int
124124 | BySignal Signal
125125
126- instance showChildProcessExit :: Show ChildProcessExit where
126+ instance showExit :: Show Exit where
127127 show (Normally x) = " Normally " <> show x
128128 show (BySignal sig) = " BySignal " <> show sig
129129
@@ -136,28 +136,28 @@ type SpawnOptions =
136136 , gid :: Maybe Int
137137 }
138138
139- mkChildProcessExit :: Nullable Int -> Nullable String -> ChildProcessExit
140- mkChildProcessExit code signal =
139+ mkExit :: Nullable Int -> Nullable String -> Exit
140+ mkExit code signal =
141141 case fromCode code <|> fromSignal signal of
142142 Just e -> e
143- Nothing -> unsafeThrow " Node.ChildProcess.mkChildProcessExit : Invalid arguments"
143+ Nothing -> unsafeThrow " Node.ChildProcess.mkExit : Invalid arguments"
144144 where
145145 fromCode = toMaybe >>> map Normally
146146 fromSignal = toMaybe >=> Signal .fromString >>> map BySignal
147147
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
150150
151151foreign 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
154154
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
157157
158158foreign 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
161161
162162onMessage :: forall eff . ChildProcess -> (Foreign -> Maybe Handle -> Eff eff Unit ) -> Eff eff Unit
163163onMessage = mkOnMessage Nothing Just
@@ -167,7 +167,7 @@ foreign import mkOnMessage :: forall a eff.
167167 ChildProcess -> (Foreign -> Maybe Handle -> Eff eff Unit ) -> Eff eff Unit
168168
169169foreign 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
171171
172172-- | Spawn a child process. Note that, in the event that a child process could
173173-- | not be spawned (for example, if the executable was not found) this will
@@ -206,7 +206,7 @@ defaultSpawnOptions =
206206 }
207207
208208-- | An error which occurred inside a child process.
209- type ChildProcessError =
209+ type Error =
210210 { code :: String
211211 , errno :: String
212212 , syscall :: String
0 commit comments