[project @ 2002-04-05 23:24:25 by sof]
[ghc-hetmet.git] / ghc / compiler / utils / Util.lhs
index 93e759b..c3833df 100644 (file)
@@ -20,6 +20,8 @@ module Util (
        nOfThem, 
        lengthExceeds, lengthIs, lengthAtLeast, listLengthCmp, atLength,
        isSingleton, only,
+       notNull,
+
        snocView,
        isIn, isn'tIn,
 
@@ -258,10 +260,10 @@ atLength atLenPred atEndPred ls n
 -- special cases.
 lengthExceeds :: [a] -> Int -> Bool
 -- (lengthExceeds xs n) = (length xs > n)
-lengthExceeds = atLength (not.null) (const False)
+lengthExceeds = atLength notNull (const False)
 
 lengthAtLeast :: [a] -> Int -> Bool
-lengthAtLeast = atLength (not.null) (== 0)
+lengthAtLeast = atLength notNull (== 0)
 
 lengthIs :: [a] -> Int -> Bool
 lengthIs = atLength null (==0)
@@ -281,6 +283,10 @@ isSingleton :: [a] -> Bool
 isSingleton [x] = True
 isSingleton  _  = False
 
+notNull :: [a] -> Bool
+notNull [] = False
+notNull _  = True
+
 only :: [a] -> a
 #ifdef DEBUG
 only [a] = a