Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.TypeChecking.Warnings

Synopsis

Monads which can log warnings

class (MonadPretty m, MonadError TCErr m) => MonadWarning (m :: Type -> Type) where Source #

Minimal complete definition

Nothing

Methods

addWarning Source #

Arguments

:: Bool

Should highlighting information be generated for this warning?

-> TCWarning

The finished warning.

-> m () 

Store a warning in the TC state. Warnings are stored regardless of whether they will be shown to the user, but, in general, highlighting information is only generated from enabled warnings.

This method should generally not be used directly: see warning instead.

default addWarning :: forall (n :: Type -> Type) (t :: (Type -> Type) -> Type -> Type). (MonadWarning n, MonadTrans t, t n ~ m) => Bool -> TCWarning -> m () Source #

Instances

Instances details
MonadWarning TCM Source # 
Instance details

Defined in Mikan.TypeChecking.Warnings

Methods

addWarning :: Bool -> TCWarning -> TCM () Source #

MonadWarning m => MonadWarning (MaybeT m) Source # 
Instance details

Defined in Mikan.TypeChecking.Warnings

Methods

addWarning :: Bool -> TCWarning -> MaybeT m () Source #

MonadWarning m => MonadWarning (ReaderT r m) Source # 
Instance details

Defined in Mikan.TypeChecking.Warnings

Methods

addWarning :: Bool -> TCWarning -> ReaderT r m () Source #

MonadWarning m => MonadWarning (StateT s m) Source # 
Instance details

Defined in Mikan.TypeChecking.Warnings

Methods

addWarning :: Bool -> TCWarning -> StateT s m () Source #

(MonadWarning m, Monoid w) => MonadWarning (WriterT w m) Source # 
Instance details

Defined in Mikan.TypeChecking.Warnings

Methods

addWarning :: Bool -> TCWarning -> WriterT w m () Source #

Warning construction

warning'_ Source #

Arguments

:: (MonadWarning m, Diagnostic e) 
=> CallStack

Original source location where the warning was added.

See warning_ for a version with HasCallStack.

-> Ranged e

The diagnostic to wrap. The included Range should be correct: if it is noRange, the diagnostic will not be associated with a position, rather than being associated with the current position.

See warning' for one that uses the eRange.

-> m TCWarning 

Construct a TCWarning from the given Diagnostic value, associating it with the Range provided by the Ranged. This handles pretty-printing the diagnostic into a warning message, including its range and the elaboration context.

warning' :: (MonadWarning m, Diagnostic e) => CallStack -> e -> m () Source #

Add a single Diagnostic value as a warning to the TC state, associated with the range of the current elaborator computation.

This function takes the warning mode into account, as with warnings'.

warnings' Source #

Arguments

:: (MonadWarning m, Diagnostic e) 
=> CallStack

The original source location to associate with the warnings.

See warnings for a version with HasCallStack.

-> List1 (Ranged e)

The diagnostics to record. The positioning note in warning'_ applies here too.

-> m () 

Add a nonempty list of Ranged Diagnostics to the TC state as warnings, constructed as per warning'_.

This takes the warning mode into account: if -Werror was given and any of the warnings in the list were enabled, they are thrown as NonFatalErrors rather than being added to the state.

raiseWarningsOnUsage :: MonadWarning m => QName -> m () Source #

Raise every WARNING_ON_USAGE connected to a name.

data WhichWarnings Source #

Classifying warnings: some are benign, others are (non-fatal) errors.

Constructors

ErrorWarnings

warnings that will be turned into errors

AllWarnings

all warnings, including errors and benign ones

data WarningsAndNonFatalErrors Source #

Assorted warnings and errors to be displayed to the user

Orphan instances