packages feed

repline 0.4.0.0 → 0.4.2.0

raw patch · 7 files changed

+68/−64 lines, 7 filesdep ~basedep ~containersdep ~mtlnew-uploaderPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, containers, mtl, process

API changes (from Hackage documentation)

+ System.Console.Repline: class MonadCatch m => MonadHaskeline m

Files

ChangeLog.md view
@@ -1,6 +1,18 @@ HEAD ==== +0.4.2.0+=======++- Add support for ghc 9.0, 9.2+- CI: Drop Travis and use Github Actions instead++0.4.1.0+=======++- Fix up documentation.+- Export `MonadHaskeline` from System.Control.Repline.+ 0.4.0.0 ======= 
README.md view
@@ -1,7 +1,7 @@ Repline ------- -[![Build Status](https://travis-ci.org/sdiehl/repline.svg)](https://travis-ci.org/sdiehl/repline)+[![Build Status](https://travis-ci.org/sdiehl/repline.svg?branch=master)](https://travis-ci.org/sdiehl/repline) [![Hackage](https://img.shields.io/hackage/v/repline.svg)](https://hackage.haskell.org/package/repline)  Slightly higher level wrapper for creating GHCi-like REPL monads that are composable with normal MTL@@ -9,7 +9,7 @@ over and decided to canonize the giant pile of hacks that I use to make Haskeline work.  See-[Documentation](https://hackage.haskell.org/package/repline-0.2.2.0/docs/System-Console-Repline.html)+[Documentation](https://hackage.haskell.org/package/repline-0.4.0.0/docs/System-Console-Repline.html) for more detailed usage.  Examples@@ -18,7 +18,7 @@ * [Simple](examples/Simple.hs) * [Prefix](examples/Prefix.hs) * [Stateful](examples/Stateful.hs)-* [Multiline](examples/MultiLine.hs)+* [Multiline](examples/Multiline.hs)  Migration from 0.3.x --------------------@@ -57,7 +57,7 @@ customBanner MultiLine = pure "| " ``` -See [Multiline](examples/MultiLine.hs) for a complete example.+See [Multiline](examples/Multiline.hs) for a complete example.  Migration from 0.2.x --------------------
examples/Multiline.hs view
@@ -2,6 +2,7 @@  import Control.Monad.Trans import Data.List (isPrefixOf)+import Data.Monoid import System.Console.Repline import System.Process (callCommand) 
examples/Prefix.hs view
@@ -4,6 +4,7 @@  module Main (main, repl) where +import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.State.Strict import Data.List (isPrefixOf) import qualified Data.Set as Set
examples/Stateful.hs view
@@ -4,6 +4,7 @@  module Main (main, repl) where +import Control.Monad.IO.Class (liftIO) import Control.Monad.State.Strict import Data.List (isPrefixOf) import Data.Monoid
repline.cabal view
@@ -1,32 +1,27 @@ name:               repline-version:            0.4.0.0+version:            0.4.2.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-2020 Stephen Diehl+copyright:          2014-2022 Stephen Diehl category:           User Interfaces build-type:         Simple extra-source-files: README.md cabal-version:      >=1.10 tested-with:-  GHC ==7.6.1-   || ==7.6.2-   || ==7.6.3-   || ==7.8.1-   || ==7.8.2-   || ==7.8.3-   || ==7.8.4-   || ==7.10.1-   || ==7.10.2-   || ==7.10.3-   || ==8.0.1-   || ==8.2.1-   || ==8.4.1-   || ==8.6.1+  GHC ==8.2.2+   || ==8.4.4+   || ==8.6.2+   || ==8.6.3+   || ==8.6.4+   || ==8.6.5    || ==8.8.1    || ==8.10.1+   || ==8.10.7+   || ==9.0.1+   || ==9.2  homepage:           https://github.com/sdiehl/repline bug-reports:        https://github.com/sdiehl/repline/issues@@ -50,7 +45,7 @@     , containers  >=0.5  && <0.7     , exceptions  >=0.10 && <0.11     , haskeline   >=0.8  && <0.9-    , mtl         >=2.2  && <2.3+    , mtl         >=2.2  && <2.4     , process     >=1.2  && <2.0    if !impl(ghc >=8.0)
src/System/Console/Repline.hs view
@@ -58,17 +58,21 @@ -- > help :: [String] -> Repl () -- > help args = liftIO $ print $ "Help: " ++ show args -- >--- > say :: [String] -> Repl ()--- > say args = do--- >   _ <- liftIO $ system $ "cowsay" ++ " " ++ (unwords args)+-- > say :: String -> Repl ()+-- > say arg = do+-- >   _ <- liftIO $ callCommand $ "cowsay" ++ " " ++ arg -- >   return () --+-- (You may need the following import in pull `callCommand` into scope)+--+-- > import System.Process (callCommand)+-- -- Now we need only map these functions to their commands. ----- > options :: [(String, [String] -> Repl ())]+-- > options :: Options (HaskelineT IO) -- > options = [--- >     ("help", help)  -- :help--- >   , ("say", say)    -- :say+-- >     ("help", help . words)  -- :help+-- >   , ("say", say)            -- :say -- >   ] -- -- The initialiser function is simply an IO action that is called at the start of the shell.@@ -78,15 +82,16 @@ -- -- The finaliser function is an IO action that is called at the end of the shell. ----- final :: Repl ExitDecision--- final = do---   liftIO $ putStrLn "Goodbye!"---   return Exit+-- > final :: Repl ExitDecision+-- > final = do+-- >   liftIO $ putStrLn "Goodbye!"+-- >   return Exit -- -- Putting it all together we have a little shell. -- -- > main :: IO ()--- > main = evalRepl (pure ">>> ") cmd options (Just ':') (Word completer) ini+-- > main = evalRepl (const . pure $ ">>> ") cmd options (Just ':') (Just "paste") (Word completer) ini final+ -- -- Alternatively instead of initialising the repl from position arguments you -- can pass the 'ReplOpts' record with explicitly named arguments.@@ -131,6 +136,7 @@   ( -- * Repline Monad     HaskelineT,     runHaskelineT,+    MonadHaskeline,      -- * Toplevel     evalRepl,@@ -166,6 +172,8 @@  import Control.Monad.Catch import Control.Monad.Fail as Fail+import Control.Monad.Fix (MonadFix)+import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Reader import Control.Monad.State.Strict import Data.List (isPrefixOf)@@ -270,20 +278,14 @@  -- | Completion loop. replLoop ::-  (Functor m, MonadMask m, MonadIO m) =>-  -- | Banner function-  (MultiLine -> HaskelineT m String) ->-  -- | Command function-  Command (HaskelineT m) ->-  -- | options function-  Options (HaskelineT m) ->-  -- | options prefix-  Maybe Char ->-  -- | multi-line command-  Maybe String ->-  -- | Finaliser ( runs on <Ctrl-D> )-  HaskelineT m ExitDecision ->-  HaskelineT m ()+  (Functor m, MonadMask m, MonadIO m)+  => (MultiLine -> HaskelineT m String) -- ^ Banner function+  -> Command (HaskelineT m) -- ^ Command function+  -> Options (HaskelineT m) -- ^ options function+  -> Maybe Char -- ^ options prefix+  -> Maybe String -- ^ multi-line command+  -> HaskelineT m ExitDecision -- ^ Finaliser ( runs on <Ctrl-D> )+  -> HaskelineT m () replLoop banner cmdM opts optsPrefix multiCommand finalz = loop   where     loop = do@@ -382,24 +384,16 @@  -- | Evaluate the REPL logic into a MonadCatch context. evalRepl ::-  (MonadMask m, MonadIO m) =>-  -- | Banner-  (MultiLine -> HaskelineT m String) ->-  -- | Command function-  Command (HaskelineT m) ->-  -- | Options list and commands-  Options (HaskelineT m) ->-  -- | Optional command prefix ( passing Nothing ignores the Options argument )-  Maybe Char ->-  -- | Optional multi-line command ( passing Nothing disables multi-line support )-  Maybe String ->-  -- | Tab completion function-  CompleterStyle m ->-  -- | Initialiser-  HaskelineT m a ->-  -- | Finaliser ( runs on Ctrl-D )-  HaskelineT m ExitDecision ->-  m ()+  (MonadMask m, MonadIO m)+  => (MultiLine -> HaskelineT m String) -- ^ Banner+  -> Command (HaskelineT m) -- ^ Command function+  -> Options (HaskelineT m) -- ^ Options list and commands+  -> Maybe Char -- ^ Optional command prefix ( passing Nothing ignores the Options argument )+  -> Maybe String -- ^ Optional multi-line command ( passing Nothing disables multi-line support )+  -> CompleterStyle m -- ^ Tab completion function+  -> HaskelineT m a -- ^ Initialiser+  -> HaskelineT m ExitDecision -- ^ Finaliser ( runs on Ctrl-D )+  -> m () evalRepl banner cmd opts optsPrefix multiCommand comp initz finalz = runHaskelineT _readline (initz >> monad)   where     monad = replLoop banner cmd opts optsPrefix multiCommand finalz