haskeline 0.7.0.3 → 0.7.1.0
raw patch · 11 files changed
+198/−151 lines, 11 filesdep ~basedep ~unix
Dependency ranges changed: base, unix
Files
- CHANGES +0/−136
- Changelog +146/−0
- System/Console/Haskeline/Backend/DumbTerm.hs +2/−1
- System/Console/Haskeline/Backend/Posix.hsc +2/−2
- System/Console/Haskeline/Backend/Terminfo.hs +5/−2
- System/Console/Haskeline/Backend/Win32.hsc +2/−2
- System/Console/Haskeline/Command.hs +9/−1
- System/Console/Haskeline/MonadException.hs +14/−0
- System/Console/Haskeline/Monads.hs +9/−1
- System/Console/Haskeline/RunCommand.hs +5/−2
- haskeline.cabal +4/−4
− CHANGES
@@ -1,136 +0,0 @@-Changed in version 0.7.0.2:- * Fix build on Windows with ghc>=7.4.1.--Changed in version 0.7.0.1:- * Fix GHC build by removing a Haskell comment on an #endif line--Changed in version 0.7.0.0:- API changes:- * Remove System.Console.Haskeline.Encoding- * Make the MonadException class more general (similar to monad-control)- * Don't make InputT an instance of MonadState/MonadReader- * #117: Implement mapInputT-- Internal changes:- * Bump dependencies and general compatibility for ghc-7.6.1- * Depend on the transformers package instead of mtl- * Don't depend on the extensible-exceptions package- * Don't depend on the utf8-string package (except with ghc<7.4.1)- * Bump the minimum GHC version to 6.10.1- * Use ScopedTypeVariables instead of PatternSignatures-- Internal fixes:- * Prevent crashes on Windows when writing too many characters at once- or ctrl-L on large window (GHC ticket #4415)- * Remember the user's history and kill ring state after ctrl-c- * Use ccall on Win64- * Fix terminfo's guess of the window size--Changed in version 0.6.4.7:- * Bump dependencies to allow mtl-2.1, containers-0.5 and bytestring-0.10.- * Prefix C functions with "haskeline_" so we don't clash with other packages- * Prevent cursor flicker when outputting in the terminfo backend--Changed in version 0.6.4.6:- * Build with ghc-7.4.1.--Changed in version 0.6.4.5:- * #116: Prevent hang on 64-bit systems when the prompt contains a control- character.--Changed in version 0.6.4.4:- * #115: Fix the behavior of the 'f' and 't' commands when deleting text.- * #73: Fix regression: pasting multiple lines could drop some characters.- * Don't require NondecreasingIndentation.--Changed in version 0.6.4.3:- * Fix a bug on ghc-7.2.1 with tab-completion of Unicode filenames.--Changed in version 0.6.4.2:- * Various updates for ghc-7.2.1.--Changed in version 0.6.4:- * Added new function getInputLineWithInitial.--Changed in version 0.6.3.2:- * Allow building with mtl-2.0.* .--Changed in version 0.6.3.1:- * Updated contraints for ghc-7.0.1.-- * Fix building on ghc-6.10.--Changed in version 0.6.3:- * #111: Correct width calculations when the prompt contains newlines.-- * #109: Add function completeWordWithPrev.-- * #101, #44: Extend the API with Behaviors, which control the choice between- terminal-style and file-style interaction.-- * #78: Correct width calculations for escape sequences ("\ESC...\STX")-- * Better warning message when -fterminfo doesn't work.-- * Added getPassword as a new input function.--Changed in version 0.6.2.4:- * Added back a MonadException instance for mtl's StateT.--Changed in version 0.6.2.3:- * #110: Recognize the enter key in xterm.-- * #108: Fix behavior after a paste of long, non-ASCII text.-- * #106: Ignore input immediately following an unrecognized control sequence.-- * #104: In vi-mode, allow, e.g., "d2w" as well as "2dw"-- * #103: Fix vi-mode 'c' command with movements.-- * #81: Correctly handle characters with a width > 1.-- * Compatibility updates from the GHC folks for Solaris and for ghc-6.14.-- * Optimization: if several key presses are input all at once (e.g. from a- paste), only display the last change. This can also make Haskeline more- responsive when editing long lines.-- * Hard-code some defaults for ctrl-left and ctrl-right, and provide the- corresponding Emacs bindings to skip words.--Changed in version 0.6.2.2:- * Raise dependency to utf8-string>=0.3.6 (fixes a bug when decoding invalid- input)--Changed in version 0.6.2.1:- Internal/API changes:- * Make sure to always use binary mode when expecting Char-as-byte.-- * Eliminate unused import warnings on ghc>=6.11-- * Increase upper bound on some dependencies for ghc-6.12--Changed in version 0.6.2:-- User interface changes:- * A multitude of new emacs and vi commands-- * New preference 'historyDuplicates' to prevent storage of duplicate lines-- * Support PageUp and PageDown keys-- * Let ctrl-L (clear-screen) work during getInputChar-- Internal/API changes:- * Compatibility with ghc-6.12-- * Calculate the correct width for Unicode combining characters-- * Removed RankNTypes requirement; added Rank2Types and UndecidableInstances-- * Use simpleUserHooks instead of autoconfUserHooks in the Setup script-- * Internal refactoring to make command declaration more flexible-- * Read the .haskeline file completely before starting the UI (laziness issue)
+ Changelog view
@@ -0,0 +1,146 @@+Changed in version 0.7.1.0:+ * Fix build with ghc-7.8.+ * Fix build with ghc-6.12.3.+ * Fix build on Android.+ * Fix build on Win64.+ * Add 'catches' to System.Console.Haskeline.MonadException.++Changed in version 0.7.0.3:+ * Fix build with ghc>=7.6.1.++Changed in version 0.7.0.2:+ * Fix build on Windows with ghc>=7.4.1.++Changed in version 0.7.0.1:+ * Fix GHC build by removing a Haskell comment on an #endif line++Changed in version 0.7.0.0:+ API changes:+ * Remove System.Console.Haskeline.Encoding+ * Make the MonadException class more general (similar to monad-control)+ * Don't make InputT an instance of MonadState/MonadReader+ * #117: Implement mapInputT++ Internal changes:+ * Bump dependencies and general compatibility for ghc-7.6.1+ * Depend on the transformers package instead of mtl+ * Don't depend on the extensible-exceptions package+ * Don't depend on the utf8-string package (except with ghc<7.4.1)+ * Bump the minimum GHC version to 6.10.1+ * Use ScopedTypeVariables instead of PatternSignatures++ Internal fixes:+ * Prevent crashes on Windows when writing too many characters at once+ or ctrl-L on large window (GHC ticket #4415)+ * Remember the user's history and kill ring state after ctrl-c+ * Use ccall on Win64+ * Fix terminfo's guess of the window size++Changed in version 0.6.4.7:+ * Bump dependencies to allow mtl-2.1, containers-0.5 and bytestring-0.10.+ * Prefix C functions with "haskeline_" so we don't clash with other packages+ * Prevent cursor flicker when outputting in the terminfo backend++Changed in version 0.6.4.6:+ * Build with ghc-7.4.1.++Changed in version 0.6.4.5:+ * #116: Prevent hang on 64-bit systems when the prompt contains a control+ character.++Changed in version 0.6.4.4:+ * #115: Fix the behavior of the 'f' and 't' commands when deleting text.+ * #73: Fix regression: pasting multiple lines could drop some characters.+ * Don't require NondecreasingIndentation.++Changed in version 0.6.4.3:+ * Fix a bug on ghc-7.2.1 with tab-completion of Unicode filenames.++Changed in version 0.6.4.2:+ * Various updates for ghc-7.2.1.++Changed in version 0.6.4:+ * Added new function getInputLineWithInitial.++Changed in version 0.6.3.2:+ * Allow building with mtl-2.0.* .++Changed in version 0.6.3.1:+ * Updated contraints for ghc-7.0.1.++ * Fix building on ghc-6.10.++Changed in version 0.6.3:+ * #111: Correct width calculations when the prompt contains newlines.++ * #109: Add function completeWordWithPrev.++ * #101, #44: Extend the API with Behaviors, which control the choice between+ terminal-style and file-style interaction.++ * #78: Correct width calculations for escape sequences ("\ESC...\STX")++ * Better warning message when -fterminfo doesn't work.++ * Added getPassword as a new input function.++Changed in version 0.6.2.4:+ * Added back a MonadException instance for mtl's StateT.++Changed in version 0.6.2.3:+ * #110: Recognize the enter key in xterm.++ * #108: Fix behavior after a paste of long, non-ASCII text.++ * #106: Ignore input immediately following an unrecognized control sequence.++ * #104: In vi-mode, allow, e.g., "d2w" as well as "2dw"++ * #103: Fix vi-mode 'c' command with movements.++ * #81: Correctly handle characters with a width > 1.++ * Compatibility updates from the GHC folks for Solaris and for ghc-6.14.++ * Optimization: if several key presses are input all at once (e.g. from a+ paste), only display the last change. This can also make Haskeline more+ responsive when editing long lines.++ * Hard-code some defaults for ctrl-left and ctrl-right, and provide the+ corresponding Emacs bindings to skip words.++Changed in version 0.6.2.2:+ * Raise dependency to utf8-string>=0.3.6 (fixes a bug when decoding invalid+ input)++Changed in version 0.6.2.1:+ Internal/API changes:+ * Make sure to always use binary mode when expecting Char-as-byte.++ * Eliminate unused import warnings on ghc>=6.11++ * Increase upper bound on some dependencies for ghc-6.12++Changed in version 0.6.2:++ User interface changes:+ * A multitude of new emacs and vi commands++ * New preference 'historyDuplicates' to prevent storage of duplicate lines++ * Support PageUp and PageDown keys++ * Let ctrl-L (clear-screen) work during getInputChar++ Internal/API changes:+ * Compatibility with ghc-6.12++ * Calculate the correct width for Unicode combining characters++ * Removed RankNTypes requirement; added Rank2Types and UndecidableInstances++ * Use simpleUserHooks instead of autoconfUserHooks in the Setup script++ * Internal refactoring to make command declaration more flexible++ * Read the .haskeline file completely before starting the UI (laziness issue)
System/Console/Haskeline/Backend/DumbTerm.hs view
@@ -8,6 +8,7 @@ import System.Console.Haskeline.Monads as Monads import System.IO+import Control.Applicative(Applicative) import Control.Monad(liftM) -- TODO: @@ -21,7 +22,7 @@ initWindow = Window {pos=0} newtype DumbTerm m a = DumbTerm {unDumbTerm :: StateT Window (PosixT m) a}- deriving (Monad, MonadIO, MonadException,+ deriving (Functor, Applicative, Monad, MonadIO, MonadException, MonadState Window, MonadReader Handles, MonadReader Encoder)
System/Console/Haskeline/Backend/Posix.hsc view
@@ -28,7 +28,7 @@ import System.IO import System.Environment -import System.Console.Haskeline.Monads+import System.Console.Haskeline.Monads hiding (Handler) import System.Console.Haskeline.Key import System.Console.Haskeline.Term as Term import System.Console.Haskeline.Prefs@@ -48,7 +48,7 @@ import GHC.Handle (withHandle_) #endif -#ifdef USE_TERMIOS_H+#if defined(USE_TERMIOS_H) || defined(__ANDROID__) #include <termios.h> #endif #include <sys/ioctl.h>
System/Console/Haskeline/Backend/Terminfo.hs view
@@ -5,6 +5,7 @@ where import System.Console.Terminfo+import Control.Applicative import Control.Monad import Data.List(foldl') import System.IO@@ -103,7 +104,7 @@ (StateT TermRows (StateT TermPos (PosixT m))))) a}- deriving (Monad, MonadIO, MonadException,+ deriving (Functor, Applicative, Monad, MonadIO, MonadException, MonadReader Actions, MonadReader Terminal, MonadState TermPos, MonadState TermRows, MonadReader Handles, MonadReader Encoder)@@ -194,7 +195,9 @@ return x output :: TermAction -> ActionM ()-output = Writer.tell+output t = Writer.tell t -- NB: explicit argument enables build with ghc-6.12.3+ -- (Probably related to the monomorphism restriction;+ -- see GHC ticket #1749). outputText :: String -> ActionM () outputText str = do
System/Console/Haskeline/Backend/Win32.hsc view
@@ -17,7 +17,7 @@ import Control.Monad import System.Console.Haskeline.Key -import System.Console.Haskeline.Monads +import System.Console.Haskeline.Monads hiding (Handler) import System.Console.Haskeline.LineState import System.Console.Haskeline.Term import System.Console.Haskeline.Backend.WCWidth @@ -431,7 +431,7 @@ foreign import ccall "wrapper" wrapHandler :: Handler -> IO (FunPtr Handler) -foreign import stdcall "windows.h SetConsoleCtrlHandler" c_SetConsoleCtrlHandler +foreign import WINDOWS_CCONV "windows.h SetConsoleCtrlHandler" c_SetConsoleCtrlHandler :: FunPtr Handler -> BOOL -> IO BOOL -- sets the tv to True when ctrl-c is pressed.
System/Console/Haskeline/Command.hs view
@@ -29,7 +29,8 @@ ) where import Data.Char(isPrint)-import Control.Monad(mplus, liftM)+import Control.Applicative(Applicative(..))+import Control.Monad(ap, mplus, liftM) import Control.Monad.Trans.Class import System.Console.Haskeline.LineState import System.Console.Haskeline.Key@@ -60,6 +61,13 @@ | Result a type Command m s t = s -> CmdM m t++instance Monad m => Functor (CmdM m) where+ fmap = liftM++instance Monad m => Applicative (CmdM m) where+ pure = return+ (<*>) = ap instance Monad m => Monad (CmdM m) where return = Result
System/Console/Haskeline/MonadException.hs view
@@ -8,6 +8,8 @@ -- * Generalizations of Control.Exception catch, handle,+ catches,+ Handler(..), finally, throwIO, throwTo,@@ -101,6 +103,18 @@ handle :: (MonadException m, Exception e) => (e -> m a) -> m a -> m a handle = flip catch+ +catches :: (MonadException m) => m a -> [Handler m a] -> m a+catches act handlers = controlIO $ \(RunIO run) ->+ let catchesHandler e = foldr tryHandler (E.throw e) handlers+ where tryHandler (Handler handler) res =+ case E.fromException e of+ Just e' -> run $ handler e'+ Nothing -> res+ in E.catch (run act) catchesHandler++data Handler m a = forall e . Exception e => Handler (e -> m a)+ bracket :: MonadException m => m a -> (a -> m b) -> (a -> m c) -> m c bracket before after thing
System/Console/Haskeline/Monads.hs view
@@ -19,7 +19,8 @@ orElse ) where -import Control.Monad (liftM)+import Control.Applicative (Applicative(..))+import Control.Monad (ap, liftM) import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Trans.Class (MonadTrans(..)) import Control.Monad.Trans.Maybe (MaybeT(..))@@ -69,6 +70,13 @@ newtype StateT s m a = StateT { getStateTFunc :: forall r . s -> m ((a -> s -> r) -> r)}++instance Monad m => Functor (StateT s m) where+ fmap = liftM++instance Monad m => Applicative (StateT s m) where+ pure = return+ (<*>) = ap instance Monad m => Monad (StateT s m) where return x = StateT $ \s -> return $ \f -> f x s
System/Console/Haskeline/RunCommand.hs view
@@ -11,8 +11,11 @@ runCommandLoop :: (CommandMonad m, MonadState Layout m, LineState s) => TermOps -> String -> KeyCommand m s a -> s -> m a-runCommandLoop tops@TermOps{evalTerm = EvalTerm eval liftE} prefix cmds initState- = eval $ withGetEvent tops+runCommandLoop tops@TermOps{evalTerm = e} prefix cmds initState+ = case e of -- NB: Need to separate this case out from the above pattern+ -- in order to build on ghc-6.12.3+ EvalTerm eval liftE+ -> eval $ withGetEvent tops $ runCommandLoop' liftE tops (stringToGraphemes prefix) initState cmds
haskeline.cabal view
@@ -1,6 +1,6 @@ Name: haskeline Cabal-Version: >=1.6-Version: 0.7.0.3+Version: 0.7.1.0 Category: User Interfaces License: BSD3 License-File: LICENSE@@ -19,7 +19,7 @@ Homepage: http://trac.haskell.org/haskeline Stability: Experimental Build-Type: Custom-extra-source-files: examples/Test.hs CHANGES+extra-source-files: examples/Test.hs Changelog source-repository head type: darcs@@ -51,7 +51,7 @@ Library if impl(ghc>=6.11) {- Build-depends: base >=4.1 && < 4.7, containers>=0.1 && < 0.6, directory>=1.0 && < 1.3,+ Build-depends: base >=4.1 && < 4.8, containers>=0.1 && < 0.6, directory>=1.0 && < 1.3, bytestring>=0.9 && < 0.11 } else {@@ -111,7 +111,7 @@ install-includes: win_console.h cpp-options: -DMINGW } else {- Build-depends: unix>=2.0 && < 2.7+ Build-depends: unix>=2.0 && < 2.8 -- unix-2.3 doesn't build on ghc-6.8.1 or earlier -- Use manual encoding/decoding on ghc<7.4 if flag (legacy-encoding) || impl(ghc<7.4) {