diff options
Diffstat (limited to 'compiler/GHC/Driver/Errors/Ppr.hs')
-rw-r--r-- | compiler/GHC/Driver/Errors/Ppr.hs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Errors/Ppr.hs b/compiler/GHC/Driver/Errors/Ppr.hs new file mode 100644 index 0000000000..06ebe0be96 --- /dev/null +++ b/compiler/GHC/Driver/Errors/Ppr.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE LambdaCase #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance Diagnostic {DriverMessage, GhcMessage} + +module GHC.Driver.Errors.Ppr where + +import GHC.Prelude + +import GHC.Types.Error +import GHC.Driver.Errors.Types +import GHC.Parser.Errors.Ppr +import GHC.Tc.Errors.Ppr () +import GHC.HsToCore.Errors.Ppr () + +instance Diagnostic GhcMessage where + diagnosticMessage = \case + GhcPsMessage m + -> diagnosticMessage m + GhcTcRnMessage m + -> diagnosticMessage m + GhcDsMessage m + -> diagnosticMessage m + GhcDriverMessage m + -> diagnosticMessage m + GhcUnknownMessage m + -> diagnosticMessage m + + diagnosticReason = \case + GhcPsMessage m + -> diagnosticReason m + GhcTcRnMessage m + -> diagnosticReason m + GhcDsMessage m + -> diagnosticReason m + GhcDriverMessage m + -> diagnosticReason m + GhcUnknownMessage m + -> diagnosticReason m + +instance Diagnostic DriverMessage where + diagnosticMessage (DriverUnknownMessage m) = diagnosticMessage m + diagnosticMessage (DriverPsHeaderMessage desc hints) + = mkSimpleDecorated $ pprPsError desc hints + + diagnosticReason (DriverUnknownMessage m) = diagnosticReason m + diagnosticReason (DriverPsHeaderMessage {}) = ErrorWithoutFlag |