projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix warning
[ghc-hetmet.git]
/
compiler
/
utils
/
Util.lhs
diff --git
a/compiler/utils/Util.lhs
b/compiler/utils/Util.lhs
index
db6f96a
..
af81110
100644
(file)
--- a/
compiler/utils/Util.lhs
+++ b/
compiler/utils/Util.lhs
@@
-32,6
+32,7
@@
module Util (
-- * List operations controlled by another list
takeList, dropList, splitAtList, split,
-- * List operations controlled by another list
takeList, dropList, splitAtList, split,
+ dropTail,
-- * For loop
nTimes,
-- * For loop
nTimes,
@@
-608,6
+609,10
@@
splitAtList (_:xs) (y:ys) = (y:ys', ys'')
where
(ys', ys'') = splitAtList xs ys
where
(ys', ys'') = splitAtList xs ys
+-- drop from the end of a list
+dropTail :: Int -> [a] -> [a]
+dropTail n = reverse . drop n . reverse
+
snocView :: [a] -> Maybe ([a],a)
-- Split off the last element
snocView [] = Nothing
snocView :: [a] -> Maybe ([a],a)
-- Split off the last element
snocView [] = Nothing