recover-rtti

Recover run-time type information from the GHC heap

Version on this page:0.5.0
Stackage Nightly 2025-03-11:0.5.0
Latest on Hackage:0.5.0@rev:1

See all snapshots recover-rtti appears in

BSD-3-Clause licensed by Edsko de Vries
Maintained by [email protected]
This version can be pinned in stack with:recover-rtti-0.5.0@sha256:7d598b0c89dac9e170b488a7a50b322fcae06342fbd2da18cb8a7f93a0b44e68,4913

Module documentation for 0.5.0

recover-rtti

Recover run-time type information from the GHC heap. The key function in this library is

classify :: a -> Either Closure (Classifier a)

which recovers type information about values about which we know nothing (in particular, no type class constraints). One example use case is the following anythingToString function:

anythingToString :: a -> String

We test that the result of anythingToString is equal to the result of regular show for a large range of data types (including user-defined ones that the library is not aware of). There are also other possible use cases; for example, it should be possible to define an anythingToJSON function.

Obviously there are limitations; the most important ones are:

There may be other gotchas as well; this library is primarily intended for debugging.

Changes

Revision history for recover-rtti

0.5.0 – 2024-06-12

  • Support ghc 9.8 and 9.10, including bytestring 0.12
  • Support ByteArray and MutableByteArray
  • Relax bounds (Marcin Szamotulski, #38)
  • Drop support for ghc 8.8

0.4.3 – 2023-06-05

  • Support aeson 2.1, vector 0.13, and primitive 0.8 (Mitchell Rosen, #29, #35, #36)
  • Support bytestring 0.11.4
  • Support ghc 9.4 and 9.6

0.4.2 – 2023-03-23

  • Support mtl 2.3 (requiring at least 2.3.1) (#26). Thanks to Rebecca Turner.

0.4.1 – 2022-03-17

  • Support for ghc 9.2, bytestring 0.11, aeson 0.2
  • Added traceAnything and traceAnythingId (#13)
  • Added deriving-via support (AnythingToString, BoxAnything) (#3)

0.4 – 2021-06-30

  • Correctly set some required lower bounds.
  • Add support for reclassification
  • Add classification equality check
  • Add support for primitive arrays and vectors
  • Fix classification on OSX
  • General internal cleanup of the library

This release is backwards incompatible with 0.3, but users that simply use anythingToString should be unaffected.

0.3.0.0 – 2021-03-17

  • Fix bug that could cause anythingToString to fail on lists with an elemUserDefined exception (issue #6). Thanks to Bit Connor for the report!

0.2.1.0 – 2021-03-17

  • Add support for unordered-containers and boxed vectors.

0.2.0.0 – 2021-03-15

  • Reorganize module structure (primarily to improve Haddocks)

0.1.0.0 – 2021-03-11

  • Alpha release