Skip to content

GHC Internal error when using deriving via on a data instance.

Summary

Compilation fails on provided source file with:

Bug.hs:17:53: error:
    • GHC internal error: ‘m’ is not in scope during type checking, but it passed the renamer
      tcl_env of environment: [at2 :-> Type variable ‘m’ = m :: *,
                               rrO :-> APromotionErr FamDataConPE]
    • In the first argument of ‘Block’, namely ‘m’
      In the first argument of ‘Header’, namely ‘(Block m)’
      In the first argument of ‘AllowThunk’, namely ‘(Header (Block m))’
   |
17 |     deriving NoThunks via AllowThunk (Header (Block m))
   |                                                     ^

Steps to reproduce

Compile the file attached to the issue.

Expected behavior

With GHC version 8.6.5 it compiles with no warnings.

Environment

  • GHC version used: 8.8.3

Optional:

  • Operating System: MacOS, Linux
  • System Architecture: x86_64

Bug.hs

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