Skip to content

GADTs: (.text+0xc6): undefined reference to `Main_IsEqual_con_info'

With this module:

{-# LANGUAGE ScopedTypeVariables, GADTs #-}

import Unsafe.Coerce

data IsEqual a b where
    IsEqual :: IsEqual a a

contextsEqual :: cxt1 -> cxt2 -> IsEqual cxt1 cxt2
contextsEqual = unsafeCoerce IsEqual

data Seq from to where
    Nil :: Seq here here

foo :: forall from to . Seq from to
foo = f undefined undefined
    where f :: from -> to -> Seq from to
          f x y = case contextsEqual x y of
                  IsEqual -> Nil

main :: IO ()
main = case foo :: Seq () () of
           Nil -> return ()

I get:

$ ghc --make z -fforce-recomp -O
[1 of 1] Compiling Main             ( z.hs, z.o )
Linking z ...
z.o: In function `smk_info':
(.text+0xc6): undefined reference to `Main_IsEqual_con_info'
collect2: ld returned 1 exit status

with the HEAD and 6.8.2.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information