Opened 7 months ago

Closed 7 months ago

Last modified 7 months 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 Difficulty: Unknown
Test Case: deriving/should_run/T8280 Blocked By:
Blocking: Related Tickets:

Description

{-# 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 (8)

comment:1 Changed 7 months ago by monoidal

  • Version changed from 7.6.3 to 7.7

comment:2 Changed 7 months ago by simonpj

  • Milestone set to 7.8.1
  • Owner set to simonpj
  • Priority changed from normal to highest

I know what's happening here.

comment:3 Changed 7 months 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 7 months ago by simonpj (previous) (diff)

comment:4 Changed 7 months ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to deriving/should_run/T8280

Thanks for reporting this.

Simon

comment:5 Changed 7 months ago by Simon Peyton Jones <simonpj@…>

comment:6 Changed 7 months 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 7 months 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 <igloo@earth.li>
    Date:   Wed Apr 23 16:11:15 2008 +0000
    
        Add 123## literals for Word#
    

comment:8 Changed 7 months ago by simonmar

Ok, thanks! Make sense now.

Note: See TracTickets for help on using tickets.