climb 0.6.0 → 0.7.0
raw patch · 3 files changed
+10/−8 lines, 3 filesdep ~linenoisePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: linenoise
API changes (from Hackage documentation)
+ Climb: [rdOnEof] :: ReplDef (m :: Type -> Type) -> !m ReplDirective
- Climb: ReplDef :: !ReplDirective -> !Text -> !Text -> !OptionCommands m -> !Command m -> !Completion m -> ReplDef (m :: Type -> Type)
+ Climb: ReplDef :: !m ReplDirective -> !m ReplDirective -> !Text -> !Text -> !OptionCommands m -> !Command m -> !Completion m -> ReplDef (m :: Type -> Type)
- Climb: [rdOnInterrupt] :: ReplDef (m :: Type -> Type) -> !ReplDirective
+ Climb: [rdOnInterrupt] :: ReplDef (m :: Type -> Type) -> !m ReplDirective
Files
- app/Main.hs +2/−1
- climb.cabal +3/−3
- src/Climb.hs +5/−4
app/Main.hs view
@@ -52,7 +52,8 @@ replDef :: ReplDef ReplM replDef = ReplDef- { rdOnInterrupt = ReplContinue+ { rdOnInterrupt = pure ReplContinue+ , rdOnEof = pure ReplQuit , rdGreeting = "Hello, REPL!" , rdPrompt = "> " , rdOptionCommands = options
climb.cabal view
@@ -7,7 +7,7 @@ -- hash: b29667bdc4492f0f51fe1df41c406056b9bbde355adb6a41eb975a30c7e7af10 name: climb-version: 0.6.0+version: 0.7.0 synopsis: Building blocks for a GHCi-like REPL with colon-commands description: Please see the README on GitHub at <https://github.com/ejconlon/climb#readme> category: User Interfaces@@ -42,7 +42,7 @@ , bytestring >=0.10 && <1 , containers >=0.6 && <1 , exceptions >=0.10 && <1- , linenoise >=0.5.0 && <1+ , linenoise >=0.6.0 && <1 , mtl >=2.2 && <3 , text >=1.2 && <3 , unliftio-core >=0.1 && <1@@ -64,7 +64,7 @@ , climb , containers >=0.6 && <1 , exceptions >=0.10 && <1- , linenoise >=0.5.0 && <1+ , linenoise >=0.6.0 && <1 , mtl >=2.2 && <3 , text >=1.2 && <3 , unliftio-core >=0.1 && <1
src/Climb.hs view
@@ -51,7 +51,8 @@ -- | Defines a REPL with commands, options, and completion. data ReplDef m = ReplDef- { rdOnInterrupt :: !ReplDirective+ { rdOnInterrupt :: !(m ReplDirective)+ , rdOnEof :: !(m ReplDirective) , rdGreeting :: !Text , rdPrompt :: !Text , rdOptionCommands :: !(OptionCommands m)@@ -115,15 +116,15 @@ -- | Runs a REPL as defined. runReplDef :: (MonadCatch m, MonadUnliftIO m) => ReplDef m -> m ()-runReplDef (ReplDef onInterrupt greeting prompt opts exec comp) = do+runReplDef (ReplDef onInterrupt onEof greeting prompt opts exec comp) = do let allOpts = fix (\c -> defaultOptions c <> opts) action = outerCommand allOpts exec handledAction = handleUserErr action liftIO (TIO.putStrLn greeting) liftIO (TIO.putStrLn "Enter `:quit` to exit or `:help` to see all commands.")- replM onInterrupt prompt handledAction comp+ replM onInterrupt onEof prompt handledAction comp -- | Processes a single line of input. Useful for testing. -- (Note that this does not handle default option commands.) stepReplDef :: (MonadThrow m) => ReplDef m -> Text -> m ReplDirective-stepReplDef (ReplDef _ _ _ opts exec _) = outerCommand opts exec+stepReplDef (ReplDef _ _ _ _ opts exec _) = outerCommand opts exec