HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleghc-10.0.0.20260917GHC2024

GHC.Types.Tickish

  • 7 types
  • 14 values
datadata GenTickish (pass :: TickishPass)
#

Constructors

  • ProfNote

    An {-# SCC #-} profiling annotation, either automatically added by the desugarer as a result of -auto-all, or added by the user.

  • HpcTick

    A "tick" used by HPC to track the execution of each subexpression in the original source code.

  • Breakpoint

    A breakpoint for the GHCi debugger. This behaves like an HPC tick, but has a list of free variables which will be available for inspection in GHCi when the program stops at the breakpoint.

    NB. we must take account of these Ids when (a) counting free variables, and (b) substituting (don't substitute for them)

  • SourceNote

    A source note.

    See Note [Source notes and debug information]

Instances8Eq, Data, Ord, Outputable, …
  • Eq (GenTickish 'TickishPassCmm)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Eq (GenTickish 'TickishPassCore)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Data (GenTickish 'TickishPassCmm)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Data (GenTickish 'TickishPassCore)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Data (GenTickish 'TickishPassStg)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Ord (GenTickish 'TickishPassCmm)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Ord (GenTickish 'TickishPassCore)Defined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • Outputable (XTickishId pass) => Outputable (GenTickish pass)Defined in ghc-10.0.0.20260917 · GHC.Core.Ppr · orphan
familytype family XTickishId (pass :: TickishPass)
#
Instances3XTickishId
  • type XTickishId 'TickishPassCmm = NoExtFieldDefined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • type XTickishId 'TickishPassCore = IdDefined in ghc-10.0.0.20260917 · GHC.Types.Tickish
  • type XTickishId 'TickishPassStg = IdDefined in ghc-10.0.0.20260917 · GHC.Types.Tickish
valuetickishCounts :: GenTickish pass -> Bool
#

A "counting tick" (for which tickishCounts is True) is one that counts evaluations in some way. We cannot discard a counting tick, and the compiler should preserve the number of counting ticks (as far as possible).

See Note [Counting ticks]

valuetickishHasNoScope :: GenTickish pass -> Bool
#

Is this a non-scoping tick, for which we don't care about precisely the extent of code that the tick encompasses?

See Note [Scoped ticks]

valuetickishHasSoftScope :: GenTickish pass -> Bool
#

A "tick with soft scoping" (for which tickishHasSoftScope is True) is one that either does not scope at all (for which tickishHasNoScope is True), or that has a "soft" scope: we allow new code to be floated into to the scope, as long as all code that was covered remains covered.

See Note [Scoped ticks]

valuetickishFloatable :: GenTickish pass -> Bool
#

Returns True for ticks that can be floated upwards easily even where it might change execution counts, such as:

Just (tick... foo) ==> tick... (Just foo)

This is a combination of tickishHasSoftScope and tickishCounts. Note that in principle splittable ticks can become floatable using mkNoTick, even though there's currently no tickish for which that is the case.

valuetickishCanSplit :: GenTickish pass -> Bool
#

Returns True for a tick that is both counting and scoping and can be split into its (tick, scope) parts using mkNoScope and mkNoTick respectively.

valuetickishIsCode :: GenTickish pass -> Bool
#

Return True if this source annotation compiles to some backend code. Without this flag, the tickish is seen as a simple annotation that does not have any associated evaluation code.

What this means that we are allowed to disregard the tick if doing so means that we can skip generating any code in the first place. A typical example is top-level bindings:

foo = tick... y -> ... ==> foo = y -> tick... ...

Here there is just no operational difference between the first and the second version. Therefore code generation should simply translate the code as if it found the latter.

datadata TickishPlacement
#

Governs the kind of expression that the tick gets placed on when annotating for example using mkTick. If we find that we want to put a tickish on an expression ruled out here, we try to float it inwards until we find a suitable expression.

See Note [Tickish placement].

Constructors

  • PlaceRuntime

    Place ticks exactly on run-time expressions, moving them through pure compile-time constructs such as other ticks, casts or type lambdas.

  • PlaceNonLam

    As PlaceRuntime, but also allow to float the tick through all lambdas.

  • PlaceCostCentre

    As PlaceNonLam, but also float through constructors, non-function variables and literals.

Instances3Eq, Show, Outputable
valuecombineTickish_maybe
  1. :: Eq (GenTickish pass)
  2. => GenTickish pass
  3. -> GenTickish pass
  4. -> Maybe (GenTickish pass)
#

Merge two ticks into one, if that is possible.

Examples:

  • combine two source note ticks if one contains the other,

  • combine a non-counting profiling tick with a non-scoping profiling tick for the same cost centre

  • combine two equal breakpoint ticks or HPC ticks

valuebestSourceNote
  1. :: Bool

    accept a location in another module if there are none in the current module?

  2. -> FastString

    the "local" source file

  3. -> [GenTickish pass]

    candidates (best first)

  4. -> Maybe (RealSrcSpan, LexicalFastString)
#

Choose the "best" source note in the given candidate list of ticks, preferring source notes that are local to the source file being consdiered.

Breakpoint tick identifiers

2 declarations
datadata BreakpointId
#

Breakpoint identifier.

Indexes into the structures in the ModBreaks created during desugaring (after inserting the breakpoint ticks in the expressions). See Note [Breakpoint identifiers]

Constructors

Instances6Eq, Data, Ord, NFData, Outputable, Binary
typetype BreakTickIndex = Int
#

Breakpoint tick index newtype BreakTickIndex = BreakTickIndex Int deriving (Eq, Ord, Data, Ix, NFData, Outputable)