ghc-10.0.0.20260917: The GHC API
Safe HaskellNone
LanguageGHC2024

GHC.Prelude

Description

Custom GHC Prelude

This module serves as a replacement for the Prelude module and abstracts over differences between the bootstrapping GHC version, and may also provide a common default vocabulary.

Synopsis

Documentation

pprSTrace :: HasCallStack => SDoc -> a -> a Source #

If debug output is on, show some SDoc on the screen along with a call stack when available.

pprTrace :: String -> SDoc -> a -> a Source #

If debug output is on, show some SDoc on the screen

pprTraceDebug :: String -> SDoc -> a -> a Source #

pprTraceException :: ExceptionMonad m => String -> SDoc -> m a -> m a Source #

pprTraceException desc x action runs action, printing a message if it throws an exception.

pprTraceIt :: Outputable a => String -> a -> a Source #

pprTraceIt desc x is equivalent to pprTrace desc (ppr x) x

pprTraceUserWarning :: HasCallStack => SDoc -> a -> a Source #

For when we want to show the user a non-fatal WARNING so that they can report a GHC bug, but don't want to panic.

pprTraceWith :: String -> (a -> SDoc) -> a -> a Source #

pprTraceWith desc f x is equivalent to pprTrace desc (f x) x. This allows you to print details from the returned value as well as from ambient variables.

pprTrace_ :: String -> SDoc -> () Source #

A version of pprTrace that is useful for quick debugging:

fooBar x y
  | cond      = body1
  | otherwise = body2
  where
    !_ = pprTrace_ "fooBar" $
         vcat [ text "x:" + ppr x
              , text "y:" + ppr y
              , text "cond:" + ppr cond
              ]

warnPprTrace :: HasCallStack => Bool -> String -> SDoc -> a -> a Source #

Just warn about an assertion failure, recording the given file and line number.