Move snocView in the file, nearer the other spliting functions
authorsimonpj@microsoft.com <unknown>
Sat, 23 Sep 2006 04:01:38 +0000 (04:01 +0000)
committersimonpj@microsoft.com <unknown>
Sat, 23 Sep 2006 04:01:38 +0000 (04:01 +0000)
compiler/utils/Util.lhs

index 8cd9e54..4ce14ab 100644 (file)
@@ -326,15 +326,6 @@ notNull :: [a] -> Bool
 notNull [] = False
 notNull _  = True
 
 notNull [] = False
 notNull _  = True
 
-snocView :: [a] -> Maybe ([a],a)
-       -- Split off the last element
-snocView [] = Nothing
-snocView xs = go [] xs
-           where
-               -- Invariant: second arg is non-empty
-             go acc [x]    = Just (reverse acc, x)
-             go acc (x:xs) = go (x:acc) xs
-
 only :: [a] -> a
 #ifdef DEBUG
 only [a] = a
 only :: [a] -> a
 #ifdef DEBUG
 only [a] = a
@@ -629,6 +620,15 @@ splitAtList (_:xs) (y:ys) = (y:ys', ys'')
     where
       (ys', ys'') = splitAtList xs ys
 
     where
       (ys', ys'') = splitAtList xs ys
 
+snocView :: [a] -> Maybe ([a],a)
+       -- Split off the last element
+snocView [] = Nothing
+snocView xs = go [] xs
+           where
+               -- Invariant: second arg is non-empty
+             go acc [x]    = Just (reverse acc, x)
+             go acc (x:xs) = go (x:acc) xs
+
 split :: Char -> String -> [String]
 split c s = case rest of
                []     -> [chunk] 
 split :: Char -> String -> [String]
 split c s = case rest of
                []     -> [chunk]