summaryrefslogtreecommitdiff
path: root/ghc/compiler/utils/Util.lhs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/compiler/utils/Util.lhs')
-rw-r--r--ghc/compiler/utils/Util.lhs5
1 files changed, 4 insertions, 1 deletions
diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs
index b16f6eb969..0911dba841 100644
--- a/ghc/compiler/utils/Util.lhs
+++ b/ghc/compiler/utils/Util.lhs
@@ -13,7 +13,7 @@ module Util (
mapAndUnzip, mapAndUnzip3,
nOfThem, filterOut,
lengthExceeds, lengthIs, lengthAtLeast, listLengthCmp, atLength,
- isSingleton, only,
+ isSingleton, only, singleton,
notNull, snocView,
isIn, isn'tIn,
@@ -299,6 +299,9 @@ listLengthCmp = atLength atLen atEnd
atLen [] = EQ
atLen _ = GT
+singleton :: a -> [a]
+singleton x = [x]
+
isSingleton :: [a] -> Bool
isSingleton [x] = True
isSingleton _ = False