on master help sign in
Merge pull request #314 from hannesm/use-iputstrln-not-print

use 'iputStrLn $ show' instead of 'print' to work nicely with ideslave

commite9424324046bf22d59423e039c8e75684e2d4431 authorEdwin Brady <edwin.brady@gmail.com> dateWed 15 May 2013, 10:09 (13 years ago) parentbe28b7fd6d5634
2 files changed+7−7
src/Idris/AbsSyntax.hs+4−3 src/Idris/REPL.hs+3−4
src/Idris/AbsSyntax.hs+4−3
@@ -270,10 +270,11 @@ iputStrLn s = do i <- getIState
270270 IdeSlave n ->
271271 case span (/=':') s of
272272 (fn, ':':rest) -> case span isDigit rest of
273− ([], ':':msg) -> iWarn (FC fn 0) msg
274− ([], msg) -> iWarn (FC fn 0) msg
273+ ([], ':':msg) -> write
274+ ([], msg) -> write
275275 (num, ':':msg) -> iWarn (FC fn (read num)) msg
276− _ -> liftIO $ putStrLn $ convSExp "write-string" s n
276+ _ -> write
277+ where write = liftIO $ putStrLn $ convSExp "write-string" s n
277278
278279iWarn :: FC -> String -> Idris ()
279280iWarn fc err = do i <- getIState
src/Idris/REPL.hs+3−4
@@ -329,7 +329,7 @@ process fn (DocStr n) = do i <- getIState
329329process fn Universes = do i <- getIState
330330 let cs = idris_constraints i
331331-- iputStrLn $ showSep "\n" (map show cs)
332− liftIO $ print (map fst cs)
332+ iputStrLn $ show (map fst cs)
333333 let n = length cs
334334 iputStrLn $ "(" ++ show n ++ " constraints)"
335335 case ucheck cs of
@@ -337,7 +337,7 @@ process fn Universes = do i <- getIState
337337 OK _ -> iResult "Universes OK"
338338process fn (Defn n) = do i <- getIState
339339 iputStrLn "Compiled patterns:\n"
340− liftIO $ print (lookupDef n (tt_ctxt i))
340+ iputStrLn $ show (lookupDef n (tt_ctxt i))
341341 case lookupCtxt n (idris_patdefs i) of
342342 [] -> return ()
343343 [(d, _)] -> do iputStrLn "Original definiton:\n"
@@ -362,8 +362,7 @@ process fn (DebugInfo n)
362362 let di = lookupCtxt n (idris_datatypes i)
363363 when (not (null di)) $ iputStrLn (show di)
364364 let d = lookupDef n (tt_ctxt i)
365− when (not (null d)) $ liftIO $
366− do print (head d)
365+ when (not (null d)) $ iputStrLn (show (head d))
367366 let cg = lookupCtxtName n (idris_callgraph i)
368367 findUnusedArgs (map fst cg)
369368 i <- getIState