Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't always use print

  • Loading branch information...
commit 0db7aa28128ed242ae0e6123c9846b96413cc38d 1 parent 4b2d02f
@mikeplus64 authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/Main.hs
View
14 src/Main.hs
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.