@@ -126,10 +126,8 @@ repl orig mods efile
126126 do ms <- H.catch (lift $ processInput input orig mods efile)
127127 (ctrlC (return (Just mods)))
128128 case ms of
129− Just mods -> let efile' = case mods of
130− [] -> efile
131− (e:_) -> e in
132− repl orig mods efile'
129+ Just mods -> let efile' = fromMaybe efile (listToMaybe mods)
130+ in repl orig mods efile'
133131 Nothing -> return ()
134132-- ctrlC)
135133-- ctrlC
@@ -154,15 +152,13 @@ repl orig mods efile
154152
155153-- | Run the REPL server
156154startServer :: PortID -> IState -> [FilePath] -> Idris ()
157−startServer port orig fn_in = do tid <- runIO $ forkOS (serverLoop port)
155+startServer port orig fn_in = do tid <- runIO $ forkIO (serverLoop port)
158156 return ()
159157 where serverLoop port = withSocketsDo $
160158 do sock <- listenOnLocalhost port
161159 loop fn orig { idris_colourRepl = False } sock
162160
163− fn = case fn_in of
164− (f:_) -> f
165− _ -> ""
161+ fn = fromMaybe "" (listToMaybe fn_in)
166162
167163 loop fn ist sock
168164 = do (h,_,_) <- accept sock
@@ -276,9 +272,7 @@ idemode h orig mods
276272 i <- getIState
277273 putIState $ i { idris_outputmode = (IdeMode id h) }
278274 idrisCatch -- to report correct id back!
279− (do let fn = case mods of
280− (f:_) -> f
281− _ -> ""
275+ (do let fn = fromMaybe "" (listToMaybe mods)
282276 case IdeMode.sexpToCommand sexp of
283277 Just cmd -> runIdeModeCommand h id orig fn mods cmd
284278 Nothing -> iPrintError "did not understand" )
@@ -683,9 +677,7 @@ processInput cmd orig inputs efile
683677 = do i <- getIState
684678 let opts = idris_options i
685679 let quiet = opt_quiet opts
686− let fn = case inputs of
687− (f:_) -> f
688− _ -> ""
680+ let fn = fromMaybe "" (listToMaybe inputs)
689681 c <- colourise
690682 case parseCmd i "(input)" cmd of
691683 Failure err -> do iputStrLn $ show (fixColour c err)