Permalink
Browse files

don't always use print

  • Loading branch information...
mikeplus64 committed Feb 9, 2013
1 parent 4b2d02f commit 0db7aa28128ed242ae0e6123c9846b96413cc38d
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/Main.hs
View
@@ -1,9 +1,17 @@
import Language.Haskell.Repl
import Control.Monad
+import System.Environment
+
+help :: String
+help = "Usage: repl [-h|-s]\n\tWhen '-s' or '--use-show' is the argument, repl will call print on the output. This makes it much easier for applications interpretting the output to know when something starts and ends. A Haskell application can just use read :: String -> [String]."
main :: IO ()
main = do
repl <- newRepl
- forever $ print
- =<< prompt repl
- =<< getLine
+ args <- getArgs
+ case args of
+ ["-h"] -> putStrLn help
+ ["--help"] -> putStrLn help
+ ["-s"] -> forever $ print =<< prompt repl =<< getLine
+ ["--use-show"] -> forever $ print =<< prompt repl =<< getLine
+ _ -> forever $ mapM_ putStrLn =<< prompt repl =<< getLine

0 comments on commit 0db7aa2

Please sign in to comment.