tag-bits-0.1.1.1: Provides access to the dynamic pointer tagging bits used by GHC.

Safe HaskellSafe-Infered

Data.TagBits

Contents

Synopsis

Inspecting the tag bits of a closure

unsafeGetTagBits :: a -> WordSource

Inspect the dynamic pointer tagging bits of a closure. This is an impure function that relies on GHC internals and may falsely return 0, but should never give the wrong tag number if it returns a non-0 value.

Determining if a closure is evaluated

unsafeIsEvaluated :: a -> BoolSource

Returns a guess as to whether or not a value has been evaluated. This is an impure function that relies on GHC internals and will return false negatives, but no false positives. This is unsafe as the value of this function will vary (from False to True) over the course of otherwise pure invocations! This first attempts to check the tag bits of the pointer, and then falls back on inspecting the info table for the closure type.