repline 0.2.0.0 → 0.2.1.0
raw patch · 5 files changed
+39/−18 lines, 5 filesdep +failPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: fail
API changes (from Hackage documentation)
+ System.Console.Repline: instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (System.Console.Repline.HaskelineT m)
- System.Console.Repline: Cursor :: (LineCompleter m) -> CompleterStyle m
+ System.Console.Repline: Cursor :: LineCompleter m -> CompleterStyle m
- System.Console.Repline: Prefix :: (CompletionFunc m) -> [(String, CompletionFunc m)] -> CompleterStyle m
+ System.Console.Repline: Prefix :: CompletionFunc m -> [(String, CompletionFunc m)] -> CompleterStyle m
- System.Console.Repline: Word :: (WordCompleter m) -> CompleterStyle m
+ System.Console.Repline: Word :: WordCompleter m -> CompleterStyle m
- System.Console.Repline: Word0 :: (WordCompleter m) -> CompleterStyle m
+ System.Console.Repline: Word0 :: WordCompleter m -> CompleterStyle m
- System.Console.Repline: type CompletionFunc (m :: * -> *) = (String, String) -> m (String, [Completion])
+ System.Console.Repline: type CompletionFunc (m :: Type -> Type) = (String, String) -> m (String, [Completion])
Files
- ChangeLog.md +17/−0
- LICENSE +1/−1
- README.md +4/−11
- repline.cabal +9/−4
- src/System/Console/Repline.hs +8/−2
+ ChangeLog.md view
@@ -0,0 +1,17 @@+HEAD+====++0.2.1.0+=======++- Add a `MonadFail` instance to `HaskelineT`.++0.2.0.0+=======++- `evalRepl` has changed signature.++0.1.0.0+=======++- Initial release.
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2016-2017 Stephen Diehl+Copyright (c) 2016-2019 Stephen Diehl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
README.md view
@@ -43,7 +43,7 @@ ini = liftIO $ putStrLn "Welcome!" repl :: IO ()-repl = evalRepl (pure ">>> ") cmd options (Word completer) ini+repl = evalRepl (pure ">>> ") cmd options Nothing (Word completer) ini ``` Trying it out:@@ -113,7 +113,7 @@ -- Tab completion inside of StateT repl :: IO () repl = flip evalStateT Set.empty- $ evalRepl (pure ">>> ") cmd opts (Word comp) init+ $ evalRepl (pure ">>> ") cmd opts Nothing (Word comp) init ``` @@ -164,7 +164,7 @@ init = return () repl :: IO ()-repl = evalRepl (pure ">>> ") cmd opts (Prefix (wordCompleter byWord) defaultMatcher) init+repl = evalRepl (pure ">>> ") cmd opts Nothing (Prefix (wordCompleter byWord) defaultMatcher) init ``` Trying it out:@@ -180,15 +180,8 @@ christmas thanksgiving festivus ``` -Installation---------------```bash-$ cabal install repline-```- License ------- -Copyright (c) 2014-2017, Stephen Diehl+Copyright (c) 2014-2019, Stephen Diehl Released under the MIT License
repline.cabal view
@@ -1,22 +1,26 @@ name: repline-version: 0.2.0.0+version: 0.2.1.0 synopsis: Haskeline wrapper for GHCi-like REPL interfaces. license: MIT license-file: LICENSE author: Stephen Diehl maintainer: stephen.m.diehl@gmail.com-copyright: 2014-2017 Stephen Diehl+copyright: 2014-2019 Stephen Diehl category: User Interfaces build-type: Simple extra-source-files: README.md cabal-version: >=1.10 tested-with: GHC == 7.6.1, GHC == 7.6.3, GHC == 7.8.3, GHC == 7.10.1 homepage: https://github.com/sdiehl/repline-Bug-Reports: https://github.com/sdiehl/repline/issues+bug-Reports: https://github.com/sdiehl/repline/issues -Description:+description: Haskeline wrapper for GHCi-like REPL interfaces. Composable with normal mtl transformers. +extra-source-files:+ README.md+ ChangeLog.md+ Source-Repository head Type: git Location: git@github.com:sdiehl/repline.git@@ -27,6 +31,7 @@ build-depends: base >= 4.6 && <5.0, containers >= 0.5 && <0.7,+ fail >= 4.9 && <4.10, mtl >= 2.2 && <2.3, process >= 1.2 && <2.0, haskeline >= 0.7 && <0.8
src/System/Console/Repline.hs view
@@ -21,8 +21,10 @@ * Completions: Handled when tab key is pressed. - * Options: Handled when a command prefixed by a colon is entered.+ * Options: Handled when a command prefixed by a prefix character is entered. + * Command prefix character: Optional command prefix ( passing Nothing ignores the Options argument ).+ * Banner: Text Displayed at initialization. * Initializer: Run at initialization.@@ -72,7 +74,7 @@ Putting it all together we have a little shell. > main :: IO ()-> main = evalRepl (pure ">>> ") cmd options (Word completer) ini+> main = evalRepl (pure ">>> ") cmd options (Just ':') (Word completer) ini Putting this in a file we can test out our cow-trek shell. @@ -134,6 +136,7 @@ import Data.List (isPrefixOf) import Control.Applicative+import Control.Monad.Fail as Fail import Control.Monad.State.Strict import Control.Monad.Reader @@ -158,6 +161,9 @@ getInputChar = H.getInputChar outputStr = H.outputStr outputStrLn = H.outputStrLn++instance Fail.MonadFail m => Fail.MonadFail (HaskelineT m) where+ fail = lift . Fail.fail instance MonadState s m => MonadState s (HaskelineT m) where get = lift get