clash-lib
Copyright(C) 2026 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Clash.Driver.Warning

Description

Emit named warnings, respecting the warning options in ClashOpts. See Clash.Warning for the warnings and the flags controlling them.

This module is deliberately kept apart from Clash.Warning: ClashOpts has a WarningOpts field, so Clash.Driver.Types imports Clash.Warning. Anything mentioning ClashOpts - everything below - would therefore introduce an import cycle if it lived in Clash.Warning.

Synopsis

Documentation

data PendingWarning Source #

A warning waiting to be reported. Pure passes collect these; whether the warning is enabled or fatal is decided by warnAbout when it is reported.

warnAbout :: ClashOpts -> PendingWarning -> IO () Source #

Report the given warning: a no-op if the warning is disabled, a (colorized) message on stderr if it is enabled, and a ClashException if it is promoted to an error (-Werror or -Werror=<name>).

warnAboutM :: CanWarn m => ClashWarning -> SrcSpan -> String -> m () Source #

warnAbout in whatever monad Clash is currently running in. Disabled warnings are dropped here, so pure monads don't collect warnings nobody is going to report. Note that warnAbout checks again, as a warning can also be reported without going through this function.

Monads that can emit warnings

class HasClashOpts m => CanWarn m where Source #

Monads Clash can emit warnings from with warnAboutM.

Minimal complete definition

Nothing

Methods

reportWarning :: PendingWarning -> m () Source #

Deliver a warning. Monads that can do IO report it right away, which is what the default implementation does. Pure monads collect the warning instead, leaving it to the driver to report it with warnAbout later.

default reportWarning :: MonadIO m => PendingWarning -> m () Source #

Instances

Instances details
CanWarn NetlistMonad Source # 
Instance details

Defined in Clash.Netlist.Types

CanWarn (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types