module Distribution.Parsec.Warning (
PWarning (..),
PWarnType (..),
showPWarning,
) where
import Distribution.Compat.Prelude
import Distribution.Parsec.Position
import Prelude ()
import System.FilePath (normalise)
data PWarnType
= PWTOther
| PWTUTF
| PWTBoolCase
| PWTVersionTag
| PWTNewSyntax
| PWTOldSyntax
| PWTDeprecatedField
| PWTInvalidSubsection
| PWTUnknownField
| PWTUnknownSection
| PWTTrailingFields
| PWTExtraMainIs
| PWTExtraTestModule
| PWTExtraBenchmarkModule
| PWTLexNBSP
| PWTLexBOM
| PWTLexTab
| PWTQuirkyCabalFile
| PWTDoubleDash
| PWTMultipleSingularField
| PWTBuildTypeDefault
| PWTVersionLeadingZeros
deriving (Eq, Ord, Show, Enum, Bounded, Generic)
instance Binary PWarnType
instance NFData PWarnType where rnf = genericRnf
data PWarning = PWarning !PWarnType !Position String
deriving (Show, Generic)
instance Binary PWarning
instance NFData PWarning where rnf = genericRnf
showPWarning :: FilePath -> PWarning -> String
showPWarning fpath (PWarning _ pos msg) =
normalise fpath ++ ":" ++ showPos pos ++ ": " ++ msg