Opened 11 years ago

Closed 5 years ago

Last modified 5 years ago

#835 closed feature request (wontfix)

Expose less type/class info in an interface file, to reduce recompilation

Reported by: simonpj Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.4.2
Keywords: Cc: Bulat.Ziganshin@…, id@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


John Meacham writes "However, whenever I change a data type or class even if they are not exported, it seems to force a full rebuild of everything that depends on that file. Is there any fundamental reason this can't be fixed? why do the non exported classes and data types end up in the hi file anyway (assuming they appear in no exported functions type signature of course)."

Solution: Fix GHC so that it doesn't expose a data type at all if nothing about it is exported; and doesn't its constructors if they are not exported, and not used in any unfolding.

Doing this would reduce recompilation changes.

Change History (9)

comment:1 Changed 11 years ago by igloo

Milestone: 6.8

comment:2 Changed 10 years ago by guest

Cc: Bulat.Ziganshin@… added

comment:3 Changed 10 years ago by Isaac Dupree

Cc: id@… added

Of course, it still may require NOINLINE pragmas in order to get the best effect, but it is exactly at those times when one wishes to have this the most.

comment:4 Changed 10 years ago by simonmar

Milestone: 6.8 branch_|_

comment:5 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 5 years ago by morabbin

Type of failure: None/Unknown

Likely obsolete, unless interface file format has not changed much in 4 years. Mark "wontix"?

comment:8 Changed 5 years ago by simonmar

Resolution: wontfix
Status: newclosed

In fact, we fixed this, and then unfixed it again recently: 9a20e540754fc2af74c2e7392f2786a81d8d5f11

The ticket isn't serving any purpose though, so I agree.

comment:9 Changed 5 years ago by simonpj

There is a long saga here. For quite while we did try to avoid exporting the consructors of a data type whose representation did not need to leak; but I finally gave up the battle in Dec 2012:

    commit 9a20e540754fc2af74c2e7392f2786a81d8d5f11
    Author: Simon Peyton Jones <>
    Date:   Thu Dec 6 16:03:16 2012 +0000

    Stop attempting to "trim" data types in interface files
    Without -O, we previously tried to make interface files smaller
    by not including the data constructors of data types.  But
    there are a lot of exceptions, notably when Template Haskell is
    involved or, more recently, DataKinds.
    However Trac #7445 shows that even without TemplateHaskell, using
    the Data class and invoking Language.Haskell.TH.Quote.dataToExpQ
    is enough to require us to expose the data constructors.
    So I've given up on this "optimisation" -- it's probably not
    important anyway.  Now I'm simply not attempting to trim off
    the data constructors.  The gain in simplicity is worth the
    modest cost in interface file growth, which is limited to the
    bits reqd to describe those data constructors.

So yes, wontfix.

Note: See TracTickets for help on using tickets.