[commit: ghc] master: Fix build (12ed5c2)

Ian Lynagh igloo at earth.li
Tue Jul 9 15:15:03 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/12ed5c2bd257e0753326b563f0f9b7619fb67b38

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

commit 12ed5c2bd257e0753326b563f0f9b7619fb67b38
Author: Ian Lynagh <ian at well-typed.com>
Date:   Sun Jul 7 21:34:17 2013 +0100

    Fix build

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

 ghc/InteractiveUI.hs | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index a2cd876..9a28480 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -2323,14 +2323,17 @@ completeCmd argLine0 = case parseLine argLine0 of
 
     -- syntax: [n-][m] with semantics "drop (n-1) . take m"
     parseRange :: String -> Maybe (Maybe Int,Maybe Int)
-    parseRange s
-        | all isDigit s = Just (Nothing, bndRead s) -- upper limit only
-        | not (null n1), sep == '-', all isDigit n1, all isDigit n2 =
-            Just (bndRead n1, bndRead n2) -- lower limit and maybe upper limit
-        | otherwise     = Nothing
+    parseRange s = case span isDigit s of
+                   (_, "") ->
+                       -- upper limit only
+                       Just (Nothing, bndRead s)
+                   (s1, '-' : s2)
+                    | all isDigit s2 ->
+                       Just (bndRead s1, bndRead s2)
+                   _ ->
+                       Nothing
       where
-        (n1,sep:n2) = span isDigit s
-        bndRead s = if null s then Nothing else Just (read s)
+        bndRead x = if null x then Nothing else Just (read x)
 
 
 





More information about the ghc-commits mailing list