Opened 4 years ago

Last modified 4 years ago

#10701 new bug

-fth-dec-file uses qualified names from hidden modules

Reported by: Fabian Owned by:
Priority: normal Milestone:
Component: Template Haskell Version: 7.10.1
Keywords: Cc: GregWeber
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

In cross compilation builds, the current TH situation is a bit of a showstopper. However, much TH code is 'safe' to cross-compile. Before the TH situation is solved, it would be great if GHC could automate as much of the work-around process as possible. -dth-dec-file is a big step on the way to create a non-TH version of the source. However, there are some problems with the generated code. One is that qualified names from hidden modules are used. A instance declaration for Aeson.ToJSON is outputted as follows:

instance Data.Aeson.Types.Class.ToJSON InputDropboxFiles where

Ideally, GHC would be able to combine the splice output with the original file, replacing all $() with the corresponding splice, and even generate correct imports. I personally think this would be a great solution to the TH problem. Most cross-compilation projects could just generate the non-TH version with the host GHC, and the few that depends on architecture specific variables can be edited before cross-compiled

Attachments (1)

Test10702.hs (790 bytes) - added by Fabian 4 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by thomie

Fabian: I think I read you have a list of issues to report, hence I'm mentioning the following;

For all bug reports, please attach or copy-paste a small program (as small as possible is best) that demonstrates the bug you found, including the instructions to compile and run it. This saves us time constructing it ourselves, and we can put it in the testsuite later. See ReportABug. Thanks!

comment:2 Changed 4 years ago by Fabian

Keywords: TH removed

comment:3 in reply to:  1 Changed 4 years ago by Fabian

Replying to thomie:

Fabian: I think I read you have a list of issues to report, hence I'm mentioning the following;

For all bug reports, please attach or copy-paste a small program (as small as possible is best) that demonstrates the bug you found, including the instructions to compile and run it. This saves us time constructing it ourselves, and we can put it in the testsuite later. See ReportABug. Thanks!

I'll put together a test case tomorrow and add it to the ticket

Changed 4 years ago by Fabian

Attachment: Test10702.hs added

comment:4 Changed 4 years ago by goldfire

Component: CompilerTemplate Haskell

comment:5 Changed 4 years ago by goldfire

Milestone: 7.12.1

comment:6 Changed 4 years ago by thomie

Cc: GregWeber added

Fabian: did you add the right test here (filename makes it appear it is for a different ticket)?

comment:7 in reply to:  6 Changed 4 years ago by Fabian

Replying to thomie:

Fabian: did you add the right test here (filename makes it appear it is for a different ticket)?

Yes it's the right file. I made one for several tickets. I have updated all tickets with a new file without the dependency on aeson, and with ddump-splices output included

However, this one was tricky and I will leave it with the aeson dependency. Someone with greater knowledge about the base packages might fix it

Last edited 4 years ago by Fabian (previous) (diff)

comment:8 Changed 4 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:9 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.