haskeline-repl 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+22/−3 lines, 3 filesdep +ansi-terminalPVP ok
version bump matches the API change (PVP)
Dependencies added: ansi-terminal
API changes (from Hackage documentation)
+ System.Console.Repl: printError :: Show a => a -> IO ()
Files
- README.md +8/−0
- haskeline-repl.cabal +3/−2
- src/System/Console/Repl.hs +11/−1
README.md view
@@ -1,1 +1,9 @@ # haskeline-repl++```haskell+module Main where++import System.Console.Repl++main = repl "echo=> " print+```
haskeline-repl.cabal view
@@ -1,5 +1,5 @@ name: haskeline-repl-version: 0.1.0.0+version: 0.2.0.0 -- synopsis: description: A convenient Haskeline wrapper homepage: https://github.com/githubuser/haskeline-repl#readme@@ -18,7 +18,8 @@ exposed-modules: System.Console.Repl build-depends: base >= 4.7 && < 5, haskeline,- mtl+ mtl,+ ansi-terminal default-language: Haskell2010 source-repository head
src/System/Console/Repl.hs view
@@ -1,6 +1,7 @@ module System.Console.Repl where import Control.Monad.Trans+import System.Console.ANSI import System.Console.Haskeline type Prompt = String@@ -10,10 +11,19 @@ repl prompt f = runInputT defaultSettings loop where- loop = getInputLine prompt >>= \line ->+ loop = do+ line <- getInputLine prompt case line of Just input -> do liftIO $ f input loop+ Just ":q" ->+ return () Nothing -> return ()+++printError err = do+ setSGR [SetColor Foreground Vivid Red]+ print err+ setSGR [Reset]