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

Error.Diagnose.Compat.Megaparsec

Description

 
Synopsis

Documentation

diagnosticFromBundle Source #

Arguments

:: forall msg s e. (IsString msg, Stream s, HasHints e msg, ShowErrorComponent e, VisualStream s, TraversableStream s) 
=> (ParseError s e -> Bool)

How to decide whether this is an error or a warning diagnostic

-> Maybe msg

An optional error code

-> msg

The error message of the diagnostic

-> Maybe [Note msg]

Default hints when trivial errors are reported

-> ParseErrorBundle s e

The bundle to create a diagnostic from

-> Diagnostic msg 

Transforms a megaparsec ParseErrorBundle into a well-formated Diagnostic ready to be shown.

errorDiagnosticFromBundle Source #

Arguments

:: forall msg s e. (IsString msg, Stream s, HasHints e msg, ShowErrorComponent e, VisualStream s, TraversableStream s) 
=> Maybe msg

An optional error code

-> msg

The error message of the diagnostic

-> Maybe [Note msg]

Default hints when trivial errors are reported

-> ParseErrorBundle s e

The bundle to create a diagnostic from

-> Diagnostic msg 

Creates an error diagnostic from a megaparsec ParseErrorBundle.

warningDiagnosticFromBundle Source #

Arguments

:: forall msg s e. (IsString msg, Stream s, HasHints e msg, ShowErrorComponent e, VisualStream s, TraversableStream s) 
=> Maybe msg

An optional error code

-> msg

The error message of the diagnostic

-> Maybe [Note msg]

Default hints when trivial errors are reported

-> ParseErrorBundle s e

The bundle to create a diagnostic from

-> Diagnostic msg 

Creates a warning diagnostic from a megaparsec ParseErrorBundle.

class HasHints e msg where Source #

A class mapping custom errors of type e with messages of type msg.

Methods

hints :: e -> [Note msg] Source #

Defines all the hints associated with a given custom error.