projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f078c03
)
Move snocView in the file, nearer the other spliting functions
author
simonpj@microsoft.com
<unknown>
Sat, 23 Sep 2006 04:01:38 +0000
(
04:01
+0000)
committer
simonpj@microsoft.com
<unknown>
Sat, 23 Sep 2006 04:01:38 +0000
(
04:01
+0000)
compiler/utils/Util.lhs
patch
|
blob
|
history
diff --git
a/compiler/utils/Util.lhs
b/compiler/utils/Util.lhs
index
8cd9e54
..
4ce14ab
100644
(file)
--- a/
compiler/utils/Util.lhs
+++ b/
compiler/utils/Util.lhs
@@
-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]