Shellac-haskeline 0.2.0.1 → 0.2.0.2
raw patch · 2 files changed
+16/−15 lines, 2 filesdep −bytestringdep ~haskelinedep ~mtlPVP ok
version bump matches the API change (PVP)
Dependencies removed: bytestring
Dependency ranges changed: haskeline, mtl
API changes (from Hackage documentation)
Files
Shellac-haskeline.cabal view
@@ -1,6 +1,6 @@ Name: Shellac-haskeline Cabal-Version: >=1.6-Version: 0.2.0.1+Version: 0.2.0.2 Category: User Interfaces License: BSD3 License-File: LICENSE@@ -16,9 +16,8 @@ Build-Type: Simple Library- Build-depends: base>=3 && <5, Shellac==0.9.*, haskeline==0.6.*, - mtl>=1.1 && < 2.1,- bytestring==0.9.*+ Build-depends: base>=3 && <5, Shellac==0.9.*, haskeline==0.7.*, + mtl>=2.0 && < 2.2 Exposed-Modules: System.Console.Shell.Backend.Haskeline ghc-options: -Wall
System/Console/Shell/Backend/Haskeline.hs view
@@ -4,14 +4,12 @@ import System.Console.Shell.Backend import System.Console.Haskeline hiding (completeFilename)-import qualified System.Console.Haskeline.Encoding as Encoding import qualified System.Console.Haskeline.History as History import System.Console.Haskeline.IO import System.IO import Data.IORef import Control.Monad.State import Data.Maybe(fromMaybe)-import qualified Data.ByteString as B data ShellacState = ShellacState { inputState :: InputState,@@ -49,7 +47,7 @@ getSingleChar = \ss pre -> queryInputState ss $ getInputChar pre, getInput = \ss pre -> queryInputState ss $ getInputLine pre, addHistory = \ss line -> queryInputState ss - $ modify $ History.addHistory line,+ $ modifyHistory $ History.addHistory line, setWordBreakChars = \ss -> writeIORef (wordBreakChars ss), getWordBreakChars = readIORef . wordBreakChars, onCancel = cancelInput . inputState,@@ -57,15 +55,16 @@ setDefaultCompletionFunction = \ss -> writeIORef (defaultCompleter ss), completeFilename = \_ -> fmap (map replacement) . listFiles, completeUsername = \_ _ -> return [],- clearHistoryState = \ss -> queryInputState ss $ put History.emptyHistory,+ clearHistoryState = \ss -> queryInputState ss $ putHistory History.emptyHistory, setMaxHistoryEntries = \ss n -> let stifle = if n < 0 then Nothing else Just n- in queryInputState ss $ modify $ History.stifleHistory stifle,- getMaxHistoryEntries = \ss -> queryInputState ss $ gets- $ fromMaybe (-1) . History.stifleAmount,+ in queryInputState ss $ modifyHistory $ History.stifleHistory stifle,+ getMaxHistoryEntries = \ss -> queryInputState ss + $ fmap (fromMaybe (-1) . History.stifleAmount)+ getHistory, readHistory = \ss file -> History.readHistory file - >>= queryInputState ss . put,- writeHistory = \ss file -> queryInputState ss get + >>= queryInputState ss . putHistory,+ writeHistory = \ss file -> queryInputState ss getHistory >>= History.writeHistory file } @@ -73,8 +72,11 @@ outputter :: BackendOutput -> InputT IO () outputter (RegularOutput str) = outputStr str outputter (InfoOutput str) = outputStr str-outputter (ErrorOutput str) = Encoding.encode str- >>= liftIO . B.hPutStr stderr+-- Haskeline has no way to directly write to stderr.+-- (outputStr may or may not go to the tty, depending on whether+-- we're running in interactive or file mode.)+-- So instead, we just use hPutStr and rely on ghc>=6.12's I/O encoding.+outputter (ErrorOutput str) = liftIO $ hPutStr stderr str wrapShellacCompleter :: String -> CompletionFunction -> Maybe (String -> IO [String])