diagnose-2.4.0: Beautiful error reporting done easily
Copyright(c) Mesabloo 2021-2022
LicenseBSD3
Stabilityexperimental
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Error.Diagnose.Report

Contents

Description

 
Synopsis

Re-exports

data Note msg Source #

A note is a piece of information that is found at the end of a report.

Constructors

Note msg

A note, which is meant to give valuable information related to the encountered error.

Hint msg

A hint, to propose potential fixes or help towards fixing the issue.

Instances

Instances details
ToJSON msg => ToJSON (Note msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

toJSON :: Note msg -> Value #

toEncoding :: Note msg -> Encoding #

toJSONList :: [Note msg] -> Value #

toEncodingList :: [Note msg] -> Encoding #

IsString msg => IsString (Note msg) Source #

Constructs a Note from the given message as a literal string.

Instance details

Defined in Error.Diagnose.Report.Internal

Methods

fromString :: String -> Note msg #

data Marker msg Source #

The type of markers with abstract message type, shown under code lines.

Constructors

This msg

A red or yellow marker under source code, marking important parts of the code.

Where msg

A blue marker symbolizing additional information.

Maybe msg

A magenta marker to report potential fixes.

Blank

An empty marker, whose sole purpose is to include a line of code in the report without markers under.

Instances

Instances details
Eq (Marker msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

(==) :: Marker msg -> Marker msg -> Bool #

(/=) :: Marker msg -> Marker msg -> Bool #

Ord (Marker msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

compare :: Marker msg -> Marker msg -> Ordering #

(<) :: Marker msg -> Marker msg -> Bool #

(<=) :: Marker msg -> Marker msg -> Bool #

(>) :: Marker msg -> Marker msg -> Bool #

(>=) :: Marker msg -> Marker msg -> Bool #

max :: Marker msg -> Marker msg -> Marker msg #

min :: Marker msg -> Marker msg -> Marker msg #

data Report msg where Source #

The type of diagnostic reports with abstract message type.

Bundled Patterns

pattern Warn :: Maybe msg -> msg -> [(Position, Marker msg)] -> [Note msg] -> Report msg

Pattern synonym for a warning report.

pattern Err :: Maybe msg -> msg -> [(Position, Marker msg)] -> [Note msg] -> Report msg

Pattern synonym for an error report.

Instances

Instances details
ToJSON msg => ToJSON (Report msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

toJSON :: Report msg -> Value #

toEncoding :: Report msg -> Encoding #

toJSONList :: [Report msg] -> Value #

toEncodingList :: [Report msg] -> Encoding #

Monoid msg => Monoid (Report msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

mempty :: Report msg #

mappend :: Report msg -> Report msg -> Report msg #

mconcat :: [Report msg] -> Report msg #

Semigroup msg => Semigroup (Report msg) Source # 
Instance details

Defined in Error.Diagnose.Report.Internal

Methods

(<>) :: Report msg -> Report msg -> Report msg #

sconcat :: NonEmpty (Report msg) -> Report msg #

stimes :: Integral b => b -> Report msg -> Report msg #

warn Source #

Arguments

:: Maybe msg

An optional error code to be shown right next to "error" or "warning".

-> msg

The report message, shown at the very top.

-> [(Position, Marker msg)]

A list associating positions with markers.

-> [Note msg]

A possibly mempty list of hints to add at the end of the report.

-> Report msg 

Deprecated: warn is deprecated. Use Warn instead.

Constructs a warning or an error report.

err Source #

Arguments

:: Maybe msg

An optional error code to be shown right next to "error" or "warning".

-> msg

The report message, shown at the very top.

-> [(Position, Marker msg)]

A list associating positions with markers.

-> [Note msg]

A possibly mempty list of hints to add at the end of the report.

-> Report msg 

Deprecated: err is deprecated. Use Err instead.

Constructs a warning or an error report.

warningToError :: Report msg -> Report msg Source #

Transforms a warning report into an error report.

errorToWarning :: Report msg -> Report msg Source #

Transforms an error report into a warning report.