Skip to content

Recover run-time type information from the GHC heap. One example use case is a "show anything" function (with no Show constraint).

License

Notifications You must be signed in to change notification settings

well-typed/recover-rtti

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Recover run-time type information from the GHC heap. One example use case is a "show anything" function (with no Show constraint).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published