Opened 7 months ago

Last modified 6 months ago

#8398 new feature request

reify module list in TH

Reported by: errge Owned by:
Priority: normal Milestone: 7.10.1
Component: Template Haskell Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Easy (less than 1 hour)
Test Case: Blocked By: #1480
Blocking: #7867 Related Tickets: #8337

Description

This patch is for the use-case detailed in #7867.

The added Q monad method provides the ability to get a list of module names in a format that is compatible with the module annotation reification in #8337.

The patch contains a helper method that depends on #8337, so that should be applied first. If this is problematic, it's easy to separate this patch into one that doesn't depend on #8337 and an other that does. Then we can add the latter later.

Attachments (2)

th-8398.patch (3.3 KB) - added by errge 7 months ago.
th part
ghc-8398.patch (1.1 KB) - added by errge 7 months ago.
ghc part

Download all attachments as: .zip

Change History (7)

Changed 7 months ago by errge

th part

Changed 7 months ago by errge

ghc part

comment:1 Changed 7 months ago by errge

  • Status changed from new to patch

comment:2 Changed 6 months ago by errge

  • Blocked By 8426 added

comment:3 Changed 6 months ago by errge

  • Component changed from Compiler to Template Haskell
  • Type changed from bug to feature request
  • Version changed from 7.6.3 to 7.7

comment:4 Changed 6 months ago by errge

  • Blocked By 1480 added; 8426 removed
  • Milestone changed from 7.8.1 to 7.10.1

This current patch seems to be a bad idea because of the reifyModuleNames API.

It returns a list of modules that are currently "known by the compiler". This "known by the compiler" is very GHC specific, related to orphan modules and hard to text as a standard that is easy to Haskell implementors to follow.

A better API to provide is "a list of modules that this module depends" and "a list of modules that this module depends on transitively".

The first is provided by #1480 and on top of that the second can be implemented as a helper method totally in Language.Haskell.TH.Lib, without introducing new Q monad instructions or changing the compiler in any way.

Therefore I'm setting this blocked by #1480 and targeting 7.10.

comment:5 Changed 6 months ago by errge

  • Status changed from patch to new
Note: See TracTickets for help on using tickets.