Skip to content

Commit 174a082

Browse files
committed
Remove repetition of names
I prefer using qualified imports to repeating the module name in a value or type name.
1 parent 1440099 commit 174a082

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Node/ChildProcess.purs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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

151151
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
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

158158
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
161161

162162
onMessage :: forall eff. ChildProcess -> (Foreign -> Maybe Handle -> Eff eff Unit) -> Eff eff Unit
163163
onMessage = 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

169169
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
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

Comments
 (0)