Handling of unlifted types

Erik de Castro Lopo mle+hs at mega-nerd.com
Sun Feb 5 08:49:26 UTC 2017

Hi all,

I'm working on pulling the core parts of Joachim Breitner's
ghc-heap-view library into GHC. The WIP Phab review is here:


Currently that library has a function:

    getClosureData :: a -> IO Closure

which works fine for lifted types. However, some of the supported
closure types in 


actually refer to unlifted types, like the `MUT_ARR_PTRS_*` and

I've had a look at the levity polymorphism stuff implemented in ghc 8.0
and came up with a new type for `getClosureData`:

    getClosureData :: forall (r :: RuntimeRep) (a :: TYPE r). a -> IO Closure

but that results in:

    A representation-polymorphic type is not allowed here:
      Type: a
      Kind: TYPE r
    In the type of binder ‘x’

Am I barking up the wrong tree here? Any one have a clue on how I might
make progress on this?

Erik de Castro Lopo

More information about the ghc-devs mailing list