From f06f40fb77bc67e87cbb5e7b8b3fca9a18c7a905 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Sat, 23 Sep 2006 04:01:38 +0000 Subject: [PATCH] Move snocView in the file, nearer the other spliting functions --- compiler/utils/Util.lhs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 8cd9e54..4ce14ab 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -326,15 +326,6 @@ notNull :: [a] -> Bool 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 @@ -629,6 +620,15 @@ splitAtList (_:xs) (y:ys) = (y:ys', 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] -- 1.7.10.4