Last active
August 29, 2015 13:56
-
-
Save edofic/9293151 to your computer and use it in GitHub Desktop.
echo repl with haskeline library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Console.Haskeline | |
import Control.Monad | |
import Control.Monad.Trans.Class | |
import Control.Monad.Trans.Maybe | |
main :: IO () | |
main = runInputT defaultSettings repl | |
repl :: InputT IO () | |
repl = fmap (const ()) $ runMaybeT $ forever $ do | |
line <- MaybeT $ getInputLine "% " | |
case line of | |
"quit" -> MaybeT $ return Nothing | |
input -> lift $ outputStrLn input | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
needs installed haskeline(and transformers)