diff options
author | Oleg Grenrus <oleg.grenrus@iki.fi> | 2016-02-01 14:32:54 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-02-01 14:33:13 +0100 |
commit | 2ad46a860f0b648aaeff224109b6045da30304d7 (patch) | |
tree | dc9f88370cfde090a5b3687f9c9f9f52adc9c8f9 | |
parent | ba88aab0d1223cd5066a66500360df4bddb159d1 (diff) | |
download | haskell-2ad46a860f0b648aaeff224109b6045da30304d7.tar.gz |
Add some Outputable instances
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1865
-rw-r--r-- | compiler/main/DynFlags.hs | 10 | ||||
-rw-r--r-- | compiler/utils/Outputable.hs | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 4b4eb77295..13f3bd744b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -604,7 +604,10 @@ data WarningFlag = deriving (Eq, Show, Enum) data Language = Haskell98 | Haskell2010 - deriving Enum + deriving (Eq, Enum, Show) + +instance Outputable Language where + ppr = text . show -- | The various Safe Haskell modes data SafeHaskellMode @@ -1675,6 +1678,11 @@ Note [Verbosity levels] data OnOff a = On a | Off a + deriving (Eq, Show) + +instance Outputable a => Outputable (OnOff a) where + ppr (On x) = text "On" <+> ppr x + ppr (Off x) = text "Off" <+> ppr x -- OnOffs accumulate in reverse order, so we use foldr in order to -- process them in the right order diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 1abb1c5b81..bf0cc905fc 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -95,6 +95,7 @@ import Platform import Pretty ( Doc, Mode(..) ) import Panic import GHC.Serialized +import GHC.LanguageExtensions (Extension) import Data.ByteString (ByteString) import qualified Data.ByteString as BS @@ -815,6 +816,9 @@ instance Outputable a => Outputable (SCC a) where instance Outputable Serialized where ppr (Serialized the_type bytes) = int (length bytes) <+> text "of type" <+> text (show the_type) +instance Outputable Extension where + ppr = text . show + {- ************************************************************************ * * |