wherefrom-compat-0.1.1.1: A compatibility layer for GHC's 'wherefrom' function

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.InfoProv.Compat

Description

This module provides a stable interface to access GHC's info provenance information. This is helpful for seeing metadata about heap objects.

Synopsis

- data InfoProv = InfoProv {
  - ipName :: String
  - ipDesc :: String
  - ipTyDesc :: String
  - ipLabel :: String
  - ipMod :: String
  - ipSrcFile :: String
  - ipSrcSpan :: String
  }
- whereFrom :: a -> IO (Maybe InfoProv)

# Documentation

data InfoProv Source #

Constructors

InfoProv |

Fields

- ipName :: String
- ipDesc :: String
- ipTyDesc :: String
- ipLabel :: String
- ipMod :: String
- ipSrcFile :: String
- ipSrcSpan :: String

#### Instances

Instances details

Show InfoProv Source # |
Instance details Defined in GHC.InfoProv.Compat Methods showsPrec :: Int -> InfoProv -> ShowS Source # show :: InfoProv -> String Source # showList :: [InfoProv] -> ShowS Source #
Eq InfoProv Source # |
Instance details Defined in GHC.InfoProv.Compat Methods (==) :: InfoProv -> InfoProv -> Bool Source # (/=) :: InfoProv -> InfoProv -> Bool Source #

whereFrom :: a -> IO (Maybe InfoProv) Source #

Get information about where a value originated from.

This information is stored statically in a binary when `super-duper` is enabled. The source positions will be greatly improved by also enabled debug information with `-g3`. Finally you can enable `-fdistinct-constructor-tables` to get more precise information about data constructor allocations.

The information is collect by looking at the info table address of a specific closure and then consulting a specially generated map (by `-finfo-table-map`) to find out where we think the best source position to describe that info table arose from.