recover-rtti: Recover run-time type information from the GHC heap

[ bsd3, debugging, library ] [ Propose Tags ]

The main function in this package is classify, which looks at the GHC heap to recover type information about arbitrary values. This makes it possible for example to show any value (function anythingToString) without having any Show instance in scope, though there are other use cases as well. For example, you could use it to define an anythingToJSON function.

[Skip to Readme]
Versions [faq],,, (info)
Change log
Dependencies aeson (==1.5.*), base (>=4.13 && <4.16), bytestring (==0.10.*), containers (==0.6.*), ghc-heap (>=8.8 && <9.1), mtl (==2.2.*), sop-core (==0.5.*), stm (==2.5.*), text (==1.2.*), unordered-containers, vector [details]
License BSD-3-Clause
Copyright Juspay Technologies Pvt Ltd, Well-Typed LLP
Author Edsko de Vries
Category Debugging
Bug tracker
Uploaded by EdskoDeVries at 2021-03-17T18:05:59Z
Distributions NixOS:
Downloads 165 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-03-17 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for recover-rtti-

[back to package description]


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

classify :: a -> 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.