Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- diagFromErrMsgs :: Text -> DynFlags -> Bag ErrMsg -> [FileDiagnostic]
- diagFromErrMsg :: Text -> DynFlags -> ErrMsg -> [FileDiagnostic]
- diagFromString :: Text -> DiagnosticSeverity -> SrcSpan -> String -> [FileDiagnostic]
- diagFromStrings :: Text -> DiagnosticSeverity -> [(SrcSpan, String)] -> [FileDiagnostic]
- diagFromGhcException :: Text -> DynFlags -> GhcException -> [FileDiagnostic]
- catchSrcErrors :: (HasDynFlags m, ExceptionMonad m) => Text -> m a -> m (Either [FileDiagnostic] a)
- srcSpanToLocation :: SrcSpan -> Location
- srcSpanToRange :: SrcSpan -> Range
- srcSpanToFilename :: SrcSpan -> FilePath
- zeroSpan :: FastString -> RealSrcSpan
- realSpan :: SrcSpan -> Maybe RealSrcSpan
- isInsideSrcSpan :: Position -> SrcSpan -> Bool
- noSpan :: String -> SrcSpan
- toDSeverity :: Severity -> Maybe DiagnosticSeverity
Producing Diagnostic values
diagFromErrMsgs :: Text -> DynFlags -> Bag ErrMsg -> [FileDiagnostic] Source #
diagFromErrMsg :: Text -> DynFlags -> ErrMsg -> [FileDiagnostic] Source #
Produce a GHC-style error from a source span and a message.
diagFromString :: Text -> DiagnosticSeverity -> SrcSpan -> String -> [FileDiagnostic] Source #
Produce a GHC-style error from a source span and a message.
diagFromStrings :: Text -> DiagnosticSeverity -> [(SrcSpan, String)] -> [FileDiagnostic] Source #
Produce a bag of GHC-style errors (ErrorMessages
) from the given
(optional) locations and message strings.
diagFromGhcException :: Text -> DynFlags -> GhcException -> [FileDiagnostic] Source #
catchSrcErrors :: (HasDynFlags m, ExceptionMonad m) => Text -> m a -> m (Either [FileDiagnostic] a) Source #
Run something in a Ghc monad and catch the errors (SourceErrors and compiler-internal exceptions like Panic or InstallationError).
utilities working with spans
srcSpanToLocation :: SrcSpan -> Location Source #
srcSpanToRange :: SrcSpan -> Range Source #
Convert a GHC SrcSpan to a DAML compiler Range
srcSpanToFilename :: SrcSpan -> FilePath Source #
Extract a file name from a GHC SrcSpan (use message for unhelpful ones) FIXME This may not be an _absolute_ file name, needs fixing.
:: FastString | file path of span |
-> RealSrcSpan |
creates a span with zero length in the filename of the argument passed
utilities working with severities
toDSeverity :: Severity -> Maybe DiagnosticSeverity Source #
Convert a GHC severity to a DAML compiler Severity. Severities below Warning level are dropped (returning Nothing).