Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,269
    • Issues 4,269
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7867

Closed
Open
Opened Apr 26, 2013 by errge@trac-errge

Allow template-haskell to communicate with itself between compilation units through the interface file

I'd like to be able to have something like this in the Q monad:

  type MessageName = String -- or something better, I don't know
  writeIface :: (Quasi q, Serializable a) => MessageName -> a -> q ()
  readIfaces :: (Quasi q, Serializable a) => MessageName -> q [a]

Or instead of returning [a], I'm of course fine with a Monoid, I just need the gathered results for every occurrance of the MessageName.

This has to be in the interface file, because I'd like this to work through compilation units, like class instances, I'd like to get every result in the readIfaces call that is ever imported from the current module (transitive closure).

Please note, that in a very hacky way this is already possible to do by abusing classes. Namely, I create an empty class for my message type. When I want to send a message, I create a new empty datatype named for the message and I make this an instance of the class. Then on the receiving side I just have to reify the class and I will receive all my instance names/messages.

This came up while implementing the HFlags library: http://hackage.haskell.org/package/hflags

Maybe I shouldn't be proud of this, but we currently do the hacky way explained above. I would love to have a clean approach.

Edited Mar 09, 2019 by Simon Peyton Jones
Assignee
Assign to
7.8.1
Milestone
7.8.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#7867