Skip to content

GHC offers no way to see the RuntimeReps in a FunTy

#19677 (closed) describes a bug where the crux is the RuntimeRep arguments to (->). But I cannot get GHC to print these.

Here is a smaller test case:

{-# LANGUAGE ExplicitForAll, DataKinds, KindSignatures #-}

module Bug where

import GHC.Exts

class C x where
  meth :: x -> ()
instance C (a -> b) where
  meth _ = ()

foo :: forall (a :: TYPE WordRep) (b :: TYPE IntRep). (a -> b) -> ()
foo = meth

The error is

Bug.hs:13:7: error:
    • No instance for (C (a -> b)) arising from a use of ‘meth’
        (maybe you haven't applied a function to enough arguments?)
    • In the expression: meth
      In an equation for ‘foo’: foo = meth
   |
13 | foo = meth
   |       ^^^^

Erroring is correct here -- there really is no applicable instance. But I don't have enough information to understand why. -fprint-explicit-runtime-reps doesn't do it. Maybe a new -fprint-explicit-fun to force GHC to use FUN in its pretty-printer?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information