Skip to content

GHCi ignores missing instance

GHCi loads modules M1 and M2. Then when Show instance in M1 is removed, reloading does not complain about the missing instance which is referred by function showField in M2. When I run any computation involving showField, for example, "const () showField", GHCi fails with the following error:

During interactive linking, GHCi couldn't find the following symbol:
  M1_zdfShowFields_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org

If I replace data family declaration in a class with a standalone data family, GHCi displays the correct error about the missing instance.

Files:

{-# LANGUAGE TypeFamilies #-}
module M1 where

class Entity v where
  data Fields v

instance Show (Fields v) where show = undefined
module M2 where

import M1

showField :: Fields v -> String
showField a = show a
Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information