summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-12-17 13:10:10 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-07 13:12:25 -0500
commit0805ed7ef32891685109b6cf3461f8adb4ca6981 (patch)
tree7c9d7c218500a695903647b54c0daa6c90ec88bd /compiler/utils
parent7aa4a0615629f36e520c11c7e40db7b1475b6402 (diff)
downloadhaskell-0805ed7ef32891685109b6cf3461f8adb4ca6981.tar.gz
Use non-empty lists to remove partiality in matching code
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/Outputable.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index 6717430a58..d81c754866 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -124,6 +124,8 @@ import Text.Printf
import Numeric (showFFloat)
import Data.Graph (SCC(..))
import Data.List (intersperse)
+import Data.List.NonEmpty (NonEmpty (..))
+import qualified Data.List.NonEmpty as NEL
import GHC.Fingerprint
import GHC.Show ( showMultiLineString )
@@ -819,6 +821,9 @@ instance Outputable () where
instance (Outputable a) => Outputable [a] where
ppr xs = brackets (fsep (punctuate comma (map ppr xs)))
+instance (Outputable a) => Outputable (NonEmpty a) where
+ ppr = ppr . NEL.toList
+
instance (Outputable a) => Outputable (Set a) where
ppr s = braces (fsep (punctuate comma (map ppr (Set.toList s))))