summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Misc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/Misc.hs')
-rw-r--r--compiler/GHC/Utils/Misc.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs
index fbf52d1bdb..29cad99cd3 100644
--- a/compiler/GHC/Utils/Misc.hs
+++ b/compiler/GHC/Utils/Misc.hs
@@ -493,6 +493,10 @@ isSingleton _ = False
notNull :: Foldable f => f a -> Bool
notNull = not . null
+-- | Utility function to go from a singleton list to it's element.
+--
+-- Wether or not the argument is a singleton list is only checked
+-- in debug builds.
only :: [a] -> a
#if defined(DEBUG)
only [a] = a