Replace Haskell API with GHC.Packing module

Taken from https://github.com/jberthold/rts-serialisation