Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
- data Diagnostic m = Diagnostic !(Either String Rendering) !DiagnosticLevel m [Diagnostic m]
- tellDiagnostic :: (MonadWriter t m, Reducer (Diagnostic e) t) => Diagnostic e -> m ()
- class Renderable t where
- class Source t
- rendering :: Source s => Delta -> s -> Rendering
- data Caret = Caret !Delta !ByteString
- data Careted a = a :^ Caret
- data Span = Span !Delta !Delta !ByteString
- data Spanned a = a :~ Span
- data Fixit = Fixit {
- fixitSpan :: !Span
- fixitReplacement :: !ByteString
- data Rendered a = a :@ Rendering
- class Monad m => MonadDiagnostic e m | m -> e where
- fatalWith :: [Diagnostic e] -> [Rendering] -> e -> m a
- errWith :: [Diagnostic e] -> [Rendering] -> e -> m a
- logWith :: DiagnosticLevel -> [Diagnostic e] -> [Rendering] -> e -> m ()
- fatal :: MonadDiagnostic e m => e -> m a
- err :: MonadDiagnostic e m => e -> m a
- warn :: MonadDiagnostic e m => e -> m ()
- note :: MonadDiagnostic e m => e -> m ()
- verbose :: MonadDiagnostic e m => Int -> e -> m ()
- warnWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m ()
- noteWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m ()
- verboseWith :: MonadDiagnostic e m => Int -> [Diagnostic e] -> [Rendering] -> e -> m ()
- data DiagnosticLevel
Diagnostics
data Diagnostic m Source
Diagnostic !(Either String Rendering) !DiagnosticLevel m [Diagnostic m] |
Functor Diagnostic | |
Typeable1 Diagnostic | |
Foldable Diagnostic | |
Traversable Diagnostic | |
Comonad Diagnostic | |
Extend Diagnostic | |
Foldable1 Diagnostic | |
Traversable1 Diagnostic | |
Show m => Show (Diagnostic m) | |
(Typeable m, Show m) => Exception (Diagnostic m) | |
Pretty m => Pretty (Diagnostic m) | |
PrettyTerm m => PrettyTerm (Diagnostic m) | |
HasBytes (Diagnostic m) | |
HasDelta (Diagnostic m) | |
Highlightable (Diagnostic e) | |
Renderable (Diagnostic m) |
tellDiagnostic :: (MonadWriter t m, Reducer (Diagnostic e) t) => Diagnostic e -> m ()Source
Rendering
class Renderable t whereSource
In file included from baz.c:9 In file included from bar.c:4 foo.c:8:36: note int main(int argc, char ** argv) { int; } ^
Functor Careted | |
Foldable Careted | |
Traversable Careted | |
Comonad Careted | |
Extend Careted | |
Foldable1 Careted | |
Traversable1 Careted | |
Eq a => Eq (Careted a) | |
Ord a => Ord (Careted a) | |
Show a => Show (Careted a) | |
Hashable a => Hashable (Careted a) | |
HasBytes (Careted a) | |
HasDelta (Careted a) | |
Renderable (Careted a) | |
Reducer (Careted a) Rendering |
Span !Delta !Delta !ByteString |
Functor Spanned | |
Foldable Spanned | |
Traversable Spanned | |
Comonad Spanned | |
Extend Spanned | |
Apply Spanned | |
Foldable1 Spanned | |
Traversable1 Spanned | |
Bind Spanned | |
Eq a => Eq (Spanned a) | |
Ord a => Ord (Spanned a) | |
Show a => Show (Spanned a) | |
Hashable a => Hashable (Spanned a) | |
Renderable (Spanned a) | |
Reducer (Spanned a) Rendering |
Fixit | |
|
Emitting diagnostics
class Monad m => MonadDiagnostic e m | m -> e whereSource
fatalWith :: [Diagnostic e] -> [Rendering] -> e -> m aSource
errWith :: [Diagnostic e] -> [Rendering] -> e -> m aSource
logWith :: DiagnosticLevel -> [Diagnostic e] -> [Rendering] -> e -> m ()Source
MonadDiagnostic e m => MonadDiagnostic e (IdentityT m) | |
MonadDiagnostic e (Parser e) | |
MonadDiagnostic e m => MonadDiagnostic e (Language m) | |
MonadDiagnostic e m => MonadDiagnostic e (Literate m) | |
MonadDiagnostic e m => MonadDiagnostic e (Layout m) | |
(MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (WriterT w m) | |
(MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (WriterT w m) | |
MonadDiagnostic e m => MonadDiagnostic e (ReaderT r m) | |
MonadDiagnostic e m => MonadDiagnostic e (StateT s m) | |
MonadDiagnostic e m => MonadDiagnostic e (StateT s m) | |
(MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (RWST r w s m) | |
(MonadDiagnostic e m, Monoid w) => MonadDiagnostic e (RWST r w s m) |
fatal :: MonadDiagnostic e m => e -> m aSource
err :: MonadDiagnostic e m => e -> m aSource
warn :: MonadDiagnostic e m => e -> m ()Source
note :: MonadDiagnostic e m => e -> m ()Source
verbose :: MonadDiagnostic e m => Int -> e -> m ()Source
warnWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m ()Source
noteWith :: MonadDiagnostic e m => [Diagnostic e] -> [Rendering] -> e -> m ()Source
verboseWith :: MonadDiagnostic e m => Int -> [Diagnostic e] -> [Rendering] -> e -> m ()Source
Diagnostic Levels
data DiagnosticLevel Source
The severity of an error (or message)
Verbose !Int | a comment we should only show to the excessively curious |
Note | a comment |
Warning | a warning, computation continues |
Error | a user specified error |
Fatal | a user specified fatal error |
Panic | a non-maskable death sentence thrown by the parser itself |
Eq DiagnosticLevel | |
Ord DiagnosticLevel | |
Read DiagnosticLevel | |
Show DiagnosticLevel | |
Semigroup DiagnosticLevel | Compute the maximum of two diagnostic levels |
Pretty DiagnosticLevel | |
PrettyTerm DiagnosticLevel | pretty print as a color coded description |