Skip to content

Data constructor ‘X’ has existential type variables, a context, or a specialised result type.

Except it does not.

{-# language TypeFamilies #-}

data family X a :: *
data instance X a = X (a -> Int)

main = undefined

This example compiles with official GHC 8.10 and the the one from the recent official master branch, but not with the one I built from your fork.

% ghc-8.11.0 X.hs
Loaded package environment from /home/kindaro/.ghc/x86_64-linux-8.11.0.20200910/environments/default
[1 of 1] Compiling Main             ( X.hs, X.o )

X.hs:4:21: error:
    • Data constructor ‘X’ has existential type variables, a context, or a specialised result type
        X :: forall a. (a -> Int) -> X a
        (Enable ExistentialQuantification or GADTs to allow this)
    • In the definition of data constructor ‘X’
      In the data instance declaration for ‘X’
  |
4 | data instance X a = X (a -> Int)
  |                     ^^^^^^^^^^^^

I initially noticed this error when trying to build hashable so you may check it as a real world example. If the extensions are enabled as it wants, there appears another, more cryptic error.

This is the version as reported:

% ghc-8.11.0 --version
The Glorious Glasgow Haskell Compilation System, version 8.11.0.20200910

I built it back in September, but I do not see any updates since then!