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.Core.Opt.Range

Range analysis

See Note [Value range analysis]

  • 2 types
  • 23 values
valuerangeIntersect :: Range -> Range -> Range
#

Compute the intersection of two overlapping ranges.

If the two ranges don't overlap, result is undefined.

valuerangeCastFrom :: Range -> Range -> Range
#

Used for casts that share representation over a sub-range (e.g. [0,127] for Word8# ([0,255]) and Int8# ([-128,127]))

If from_range isn't fully included into to_range, then we return to_range. That's because for now we don't have a way to track disjoined ranges. E.g. if we wanted to cast -1,10 into 0,255, we would need to represent a range union: [0,10] U 255,255

We also use this function to ensure that the result of an arithmetic operation on ranges didn't overflow/underflow.