| Copyright | (C) 2026 QBayLogic B.V. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Clash.Driver.Warning
Contents
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
- data PendingWarning = PendingWarning {}
- warnAbout :: ClashOpts -> PendingWarning -> IO ()
- warnAboutM :: CanWarn m => ClashWarning -> SrcSpan -> String -> m ()
- class HasClashOpts m => CanWarn m where
- reportWarning :: PendingWarning -> m ()
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.
Constructors
| PendingWarning | |
Fields | |
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 #
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
| CanWarn NetlistMonad Source # | |
Defined in Clash.Netlist.Types Methods reportWarning :: PendingWarning -> NetlistMonad () Source # | |
| CanWarn (RewriteMonad extra) Source # | |
Defined in Clash.Rewrite.Types Methods reportWarning :: PendingWarning -> RewriteMonad extra () Source # | |