diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2019-12-17 13:10:10 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-01-07 13:12:25 -0500 |
commit | 0805ed7ef32891685109b6cf3461f8adb4ca6981 (patch) | |
tree | 7c9d7c218500a695903647b54c0daa6c90ec88bd /compiler/utils | |
parent | 7aa4a0615629f36e520c11c7e40db7b1475b6402 (diff) | |
download | haskell-0805ed7ef32891685109b6cf3461f8adb4ca6981.tar.gz |
Use non-empty lists to remove partiality in matching code
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/Outputable.hs | 5 |
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)))) |