Skip to content

Instantly share code, notes, and snippets.

@edofic
Last active August 29, 2015 13:56
Show Gist options
  • Save edofic/9293151 to your computer and use it in GitHub Desktop.
Save edofic/9293151 to your computer and use it in GitHub Desktop.
echo repl with haskeline library
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
@edofic
Copy link
Author

edofic commented Mar 1, 2014

needs installed haskeline(and transformers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment