@@ -58,7 +58,7 @@ import System.IO
5858import Control.Monad
5959import Control.Monad.Trans.Error (ErrorT(..))
6060import Control.Monad.Trans.State.Strict ( StateT, execStateT, get, put )
61−import Control.Monad.Trans ( liftIO, lift )
61+import Control.Monad.Trans ( lift )
6262import Data.Maybe
6363import Data.List
6464import Data.Char
@@ -111,7 +111,7 @@ ideslaveStart orig mods
111111ideslave :: IState -> [FilePath] -> Idris ()
112112ideslave orig mods
113113 = do idrisCatch
114− (do l <- liftIO $ getLine
114+ (do l <- runIO $ getLine
115115 let (sexp, id) = parseMessage l
116116 i <- getIState
117117 putIState $ i { idris_outputmode = (IdeSlave id) }
@@ -134,7 +134,7 @@ ideslave orig mods
134134 Just (REPLCompletions str) ->
135135 do (unused, compls) <- replCompletion (reverse str, "")
136136 let good = SexpList [SymbolAtom "ok", toSExp (map replacement compls, reverse unused)]
137− liftIO $ putStrLn $ convSExp "return" good id
137+ runIO $ putStrLn $ convSExp "return" good id
138138 Just (LoadFile filename) ->
139139 do clearErr
140140 putIState (orig { idris_options = idris_options i,
@@ -224,7 +224,7 @@ processInput cmd orig inputs
224224 _ -> ""
225225 c <- colourise
226226 case parseCmd i "(input)" cmd of
227− Failure err -> do liftIO $ print (fixColour c err)
227+ Failure err -> do runIO $ print (fixColour c err)
228228 return (Just inputs)
229229 Success Reload ->
230230 do putIState $ orig { idris_options = idris_options i
@@ -275,13 +275,13 @@ edit :: FilePath -> IState -> Idris ()
275275edit "" orig = iputStrLn "Nothing to edit"
276276edit f orig
277277 = do i <- getIState
278− env <- liftIO $ getEnvironment
278+ env <- runIO $ getEnvironment
279279 let editor = getEditor env
280280 let line = case errLine i of
281281 Just l -> " +" ++ show l ++ " "
282282 Nothing -> " "
283283 let cmd = editor ++ line ++ f
284− liftIO $ system cmd
284+ runIO $ system cmd
285285 clearErr
286286 putIState $ orig { idris_options = idris_options i
287287 , idris_colourTheme = idris_colourTheme i
@@ -311,7 +311,7 @@ insertScript prf (x : xs) = x : insertScript prf xs
311311process :: FilePath -> Command -> Idris ()
312312process fn Help = iPrintResult displayHelp
313313process fn (ChangeDirectory f)
314− = do liftIO $ setCurrentDirectory f
314+ = do runIO $ setCurrentDirectory f
315315 return ()
316316process fn (Eval t)
317317 = do (tm, ty) <- elabVal toplevel False t
@@ -443,17 +443,17 @@ process fn (RmProof n')
443443
444444process fn' (AddProof prf)
445445 = do fn <- do
446− ex <- liftIO $ doesFileExist fn'
446+ ex <- runIO $ doesFileExist fn'
447447 let fnExt = fn' <.> "idr"
448− exExt <- liftIO $ doesFileExist fnExt
448+ exExt <- runIO $ doesFileExist fnExt
449449 if ex
450450 then return fn'
451451 else if exExt
452452 then return fnExt
453453 else ifail $ "Neither \""++fn'++"\" nor \""++fnExt++"\" exist"
454454 let fb = fn ++ "~"
455− liftIO $ copyFile fn fb -- make a backup in case something goes wrong!
456− prog <- liftIO $ readFile fb
455+ runIO $ copyFile fn fb -- make a backup in case something goes wrong!
456+ prog <- runIO $ readFile fb
457457 i <- getIState
458458 let proofs = proof_list i
459459 n' <- case prf of
@@ -465,7 +465,7 @@ process fn' (AddProof prf)
465465 case lookup n proofs of
466466 Nothing -> iputStrLn "No proof to add"
467467 Just p -> do let prog' = insertScript (showProof (lit fn) n p) ls
468− liftIO $ writeFile fn (unlines prog')
468+ runIO $ writeFile fn (unlines prog')
469469 removeProof n
470470 iputStrLn $ "Added proof " ++ show n
471471 where ls = (lines prog)
@@ -513,11 +513,11 @@ process fn Execute = do (m, _) <- elabVal toplevel False
513513 (PRef fc (UN "run__IO"))
514514 [pexp $ PRef fc (NS (UN "main") ["Main"])])
515515-- (PRef (FC "main" 0) (NS (UN "main") ["main"]))
516− (tmpn, tmph) <- liftIO tempfile
517− liftIO $ hClose tmph
516+ (tmpn, tmph) <- runIO tempfile
517+ runIO $ hClose tmph
518518 t <- codegen
519519 compile t tmpn m
520− liftIO $ system tmpn
520+ runIO $ system tmpn
521521 return ()
522522 where fc = FC "main" 0
523523process fn (Compile codegen f)
@@ -774,10 +774,10 @@ idrisMain opts =
774774 [] -> 2
775775 xs -> last xs
776776 trpl <- case opt getTriple opts of
777− [] -> liftIO $ getDefaultTargetTriple
777+ [] -> runIO $ getDefaultTargetTriple
778778 xs -> return (last xs)
779779 tcpu <- case opt getCPU opts of
780− [] -> liftIO $ getHostCPUName
780+ [] -> runIO $ getHostCPUName
781781 xs -> return (last xs)
782782 let outty = case opt getOutputTy opts of
783783 [] -> Executable
@@ -788,7 +788,7 @@ idrisMain opts =
788788 script <- case opt getExecScript opts of
789789 [] -> return Nothing
790790 x:y:xs -> do iputStrLn "More than one interpreter expression found."
791− liftIO $ exitWith (ExitFailure 1)
791+ runIO $ exitWith (ExitFailure 1)
792792 [expr] -> return (Just expr)
793793 when (DefaultTotal `elem` opts) $ do i <- getIState
794794 putIState (i { default_total = True })
@@ -809,11 +809,11 @@ idrisMain opts =
809809 -- if we have the --fovm flag, drop into the first order VM testing
810810 case vm of
811811 [] -> return ()
812− xs -> liftIO $ mapM_ (fovm cgn outty) xs
812+ xs -> runIO $ mapM_ (fovm cgn outty) xs
813813 -- if we have the --bytecode flag, drop into the bytecode assembler
814814 case bcs of
815815 [] -> return ()
816− xs -> return () -- liftIO $ mapM_ bcAsm xs
816+ xs -> return () -- runIO $ mapM_ bcAsm xs
817817 case ibcsubdir of
818818 [] -> setIBCSubDir ""
819819 (d:_) -> setIBCSubDir d
@@ -829,7 +829,7 @@ idrisMain opts =
829829
830830 loadInputs inputs
831831
832− liftIO $ hSetBuffering stdout LineBuffering
832+ runIO $ hSetBuffering stdout LineBuffering
833833
834834 ok <- noErrors
835835 when ok $ case output of
@@ -845,7 +845,7 @@ idrisMain opts =
845845 when (runrepl && not idesl) $ runInputT (replSettings (Just historyFile)) $ repl ist inputs
846846 when (idesl) $ ideslaveStart ist inputs
847847 ok <- noErrors
848− when (not ok) $ liftIO (exitWith (ExitFailure 1))
848+ when (not ok) $ runIO (exitWith (ExitFailure 1))
849849 where
850850 makeOption (OLogging i) = setLogLevel i
851851 makeOption TypeCase = setTypeCase True
@@ -855,7 +855,7 @@ idrisMain opts =
855855 makeOption _ = return ()
856856
857857 addPkgDir :: String -> Idris ()
858− addPkgDir p = do ddir <- liftIO $ getDataDir
858+ addPkgDir p = do ddir <- runIO $ getDataDir
859859 addImportDir (ddir </> p)
860860
861861execScript :: String -> Idris ()
@@ -863,11 +863,11 @@ execScript expr = do i <- getIState
863863 c <- colourise
864864 case parseExpr i expr of
865865 Failure err -> do iputStrLn $ show (fixColour c err)
866− liftIO $ exitWith (ExitFailure 1)
866+ runIO $ exitWith (ExitFailure 1)
867867 Success term -> do ctxt <- getContext
868868 (tm, _) <- elabVal toplevel False term
869869 res <- execute tm
870− liftIO $ exitWith ExitSuccess
870+ runIO $ exitWith ExitSuccess
871871
872872-- | Check if the coloring matches the options and corrects if necessary
873873fixColour :: Bool -> ANSI.Doc -> ANSI.Doc
@@ -876,7 +876,7 @@ fixColour True doc = doc
876876
877877-- | Get the platform-specific, user-specific Idris dir
878878getIdrisUserDataDir :: Idris FilePath
879−getIdrisUserDataDir = liftIO $ getAppUserDataDirectory "idris"
879+getIdrisUserDataDir = runIO $ getAppUserDataDirectory "idris"
880880
881881-- | Locate the platform-specific location for the init script
882882getInitScript :: Idris FilePath
@@ -886,24 +886,24 @@ getInitScript = do idrisDir <- getIdrisUserDataDir
886886-- | Run the initialisation script
887887initScript :: Idris ()
888888initScript = do script <- getInitScript
889− idrisCatch (do go <- liftIO $ doesFileExist script
889+ idrisCatch (do go <- runIO $ doesFileExist script
890890 when go $ do
891− h <- liftIO $ openFile script ReadMode
891+ h <- runIO $ openFile script ReadMode
892892 runInit h
893− liftIO $ hClose h)
893+ runIO $ hClose h)
894894 (\e -> iPrintError $ "Error reading init file: " ++ show e)
895895 where runInit :: Handle -> Idris ()
896896 runInit h = do eof <- lift . lift $ hIsEOF h
897897 ist <- getIState
898898 unless eof $ do
899− line <- liftIO $ hGetLine h
899+ line <- runIO $ hGetLine h
900900 script <- getInitScript
901901 c <- colourise
902902 processLine ist line script c
903903 runInit h
904904 processLine i cmd input clr =
905905 case parseCmd i input cmd of
906− Failure err -> liftIO $ print (fixColour clr err)
906+ Failure err -> runIO $ print (fixColour clr err)
907907 Success Reload -> iPrintError "Init scripts cannot reload the file"
908908 Success (Load f) -> iPrintError "Init scripts cannot load files"
909909 Success (ModImport f) -> iPrintError "Init scripts cannot import modules"