diff options
Diffstat (limited to 'compiler/utils')
| -rw-r--r-- | compiler/utils/Util.lhs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 90a2077c71..e2fd0aa093 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -18,7 +18,7 @@ module Util ( unzipWith, - mapFst, mapSnd, + mapFst, mapSnd, chkAppend, mapAndUnzip, mapAndUnzip3, mapAccumL2, nOfThem, filterOut, partitionWith, splitEithers, @@ -259,6 +259,13 @@ splitEithers (e : es) = case e of Left x -> (x:xs, ys) Right y -> (xs, y:ys) where (xs,ys) = splitEithers es + +chkAppend :: [a] -> [a] -> [a] +-- Checks for the second arguemnt being empty +-- Used in situations where that situation is common +chkAppend xs ys + | null ys = xs + | otherwise = xs ++ ys \end{code} A paranoid @zip@ (and some @zipWith@ friends) that checks the lists |
