breakpoint-0.1.2.1: Set breakpoints using a GHC plugin
Safe HaskellSafe-Inferred
LanguageHaskell2010

Debug.Breakpoint

Synopsis

Plugin

API

breakpoint :: a -> a Source #

Sets a breakpoint in pure code

breakpointM :: Applicative m => m () Source #

Sets a breakpoint in an arbitrary Applicative. Uses unsafePerformIO which means that laziness and common sub-expression elimination can result in the breakpoint not being hit as expected. For this reason, you should prefer breakpointIO if a MonadIO instance is available.

breakpointIO :: MonadIO m => m () Source #

Sets a breakpoint in an IO based Monad. You should favor this over breakpointM if the monad can perform IO.

queryVars :: a -> a Source #

When evaluated, displays the names of variables visible from the callsite and starts a prompt where entering a variable will display its value. You may want to use this instead of breakpoint if there are value which should stay unevaluated or you are only interested in certain values. Only the current thread is blocked while the prompt is active. To resume execution, press enter with a blank prompt.

queryVarsM :: Applicative m => m () Source #

Similar to queryVars but for use in an arbitrary Applicative context. This uses unsafePerformIO which means that laziness and common sub-expression elimination can result in unexpected behavior. For this reason you should prefer queryVarsIO if a MonadIO instance is available.

queryVarsIO :: MonadIO m => m () Source #

Similar to queryVars but specialized to an IO context. You should favor this over queryVarsM if a MonadIO instance is available.

excludeVars :: [String] -> a -> a Source #

Excludes the given variable names from appearing in the output of any breakpoints occurring in the given expression.

Internals

captureVars :: Map String String Source #

Constructs a lazy Map from the names of all visible variables at the call site to a string representation of their value. Does not include any variables whose definitions contain it. Be careful not to assign multiple variables to captureVars in the same scope as this will result in an infinite recursion.

showLev :: ShowLev rep a => a -> String Source #

fromAscList :: Ord k => [(k, v)] -> Map k v Source #

runPromptIO :: forall m. MonadIO m => String -> Map String String -> m () Source #

getSrcLoc :: String Source #

Pretty prints the source code location of its call site