@hackage / recover-rtti

Recover run-time type information from the GHC heap

Latest0.6.1

About

Metadata

  • Last updated , by EdskoDeVries
  • License BSD-3-Clause
  • Categories Debugging
  • Maintained by: edsko@well-typed.com

  • Lottery factor: 2

Links

Installation

Tested Compilers

  1. 9.10.3
  2. 9.8.4
  3. 9.6.7
  4. 9.4.8
  5. 9.2.8

Readme

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.