[commit: packages/haskeline] master: Fix TODO: messageState param not needed anymore (e18a11f)

git at git.haskell.org git at git.haskell.org
Mon Dec 15 13:17:11 UTC 2014


Repository : ssh://git@git.haskell.org/haskeline

On branch  : master
Link       : http://git.haskell.org/packages/haskeline.git/commitdiff/e18a11fa2a23f34b40ee5b661932da6fdd990f3f

>---------------------------------------------------------------

commit e18a11fa2a23f34b40ee5b661932da6fdd990f3f
Author: Philip Dexter <philip.dexter at gmail.com>
Date:   Sat Sep 27 11:46:22 2014 -0400

    Fix TODO: messageState param not needed anymore


>---------------------------------------------------------------

e18a11fa2a23f34b40ee5b661932da6fdd990f3f
 System/Console/Haskeline/Command/Completion.hs | 4 ++--
 System/Console/Haskeline/LineState.hs          | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/System/Console/Haskeline/Command/Completion.hs b/System/Console/Haskeline/Command/Completion.hs
index 2f42b2b..97a887b 100644
--- a/System/Console/Haskeline/Command/Completion.hs
+++ b/System/Console/Haskeline/Command/Completion.hs
@@ -85,7 +85,7 @@ askFirst :: Monad m => Prefs -> Int -> CmdM m ()
             -> CmdM m ()
 askFirst prefs n cmd
     | maybe False (< n) (completionPromptLimit prefs) = do
-        _ <- setState (Message () $ "Display all " ++ show n
+        _ <- setState (Message $ "Display all " ++ show n
                                  ++ " possibilities? (y or n)")
         keyChoiceCmdM [
             simpleChar 'y' +> cmd
@@ -96,7 +96,7 @@ askFirst prefs n cmd
 pageCompletions :: MonadReader Layout m => [String] -> CmdM m ()
 pageCompletions [] = return ()
 pageCompletions wws@(w:ws) = do
-    _ <- setState $ Message () "----More----"
+    _ <- setState $ Message "----More----"
     keyChoiceCmdM [
         simpleChar '\n' +> oneLine
         , simpleKey DownKey +> oneLine
diff --git a/System/Console/Haskeline/LineState.hs b/System/Console/Haskeline/LineState.hs
index 4f15898..79537bf 100644
--- a/System/Console/Haskeline/LineState.hs
+++ b/System/Console/Haskeline/LineState.hs
@@ -356,10 +356,9 @@ applyCmdArg :: (InsertMode -> InsertMode) -> ArgMode CommandMode -> CommandMode
 applyCmdArg f am = withCommandMode (repeatN (arg am) f) (argState am)
 
 ---------------
--- TODO: messageState param not needed anymore.
-data Message s = Message {messageState :: s, messageText :: String}
+newtype Message = Message {messageText :: String}
 
-instance LineState (Message s) where
+instance LineState Message where
     beforeCursor _ = stringToGraphemes . messageText
     afterCursor _ = []
 



More information about the ghc-commits mailing list