Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#8280 closed bug (fixed)

Deriving Show for Word#

Reported by: monoidal Owned by: simonpj
Priority: highest Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: deriving/should_run/T10104
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


{-# LANGUAGE MagicHash #-}
import GHC.Prim
data A = A Word# deriving Show

This works in 7.6.3, but 7.7 gives

    Can't find interface-file declaration for data constructor GHC.Types.W#
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error

The same file works if Word# is replaced by Int#.

Change History (9)

comment:1 Changed 6 years ago by monoidal


comment:2 Changed 6 years ago by simonpj

Milestone: 7.8.1
Owner: set to simonpj
Priority: normalhighest

I know what's happening here.

comment:3 Changed 6 years ago by Simon Peyton Jones <simonpj@…>

In de4090bc7d8da8c28c22c27fa384e1a2c01508c4/ghc:

Make Word# a wired-in TyCon (fix Trac #8280)

wordTyCon was treated as wired-in, but
  * It didn't have a WiredInName
  * It didn't appear in the list of wiredInTyCons

I'm not sure how anything worked!
Last edited 6 years ago by simonpj (previous) (diff)

comment:4 Changed 6 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: deriving/should_run/T8280

Thanks for reporting this.


comment:5 Changed 6 years ago by Simon Peyton Jones <simonpj@…>

comment:6 Changed 6 years ago by simonmar

There are a few things I'm confused about here.

  1. The commit log says "make Word# a wired-in type", but actually it makes Word a wired-in type. (Word# is a primitive type)
  2. Why does the example program need to know anything about W#, the constructor for Word, when it only mentioned Word#?
  3. Why does Word need to be a wired-in type at all?

comment:7 Changed 6 years ago by simonpj

  1. Sorry
  2. See Note [Deriving and unboxed types] in TcDeriv. It should be a bit longer and more explicit.
  3. Grep for wordDataCon. I think Word became wired in this commit:
    commit 6821c8a47c0fc61a2d989d368f926cc0ded776e9
    Author: Ian Lynagh <>
    Date:   Wed Apr 23 16:11:15 2008 +0000
        Add 123## literals for Word#

comment:8 Changed 6 years ago by simonmar

Ok, thanks! Make sense now.

comment:9 Changed 5 years ago by thomie

Test Case: deriving/should_run/T8280deriving/should_run/T10104

With Phab:D672 (#10104), deriving/should_run/T10104 supersedes deriving/should_run/T8280.

Note: See TracTickets for help on using tickets.