Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,870
    • Issues 4,870
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5406
Closed
Open
Created Aug 11, 2011 by reinerp@trac-reinerp

Template Haskell: Reification of type family instances

In Template Haskell, there's no way to find out all instances of a type or data family. Manuel commented on this in an old patch (third dot-point):

Tue Mar 24 20:34:47 PDT 2009  Manuel M T Chakravarty <chak at cse.unsw.edu.au>
  * Template Haskell: make reify aware of type families
  Ignore-this: 4b9c2d626e7c506a74331bb91d0fcff7
  - Reifying a type family returns a TH family declaration
  - Reifying a data constructor from a data instance attributes that
    constructor to the family (not the representation tycon)
  - Ideally, we should have facilities to reify all type/data instances of a 
    given family (and the same for instances of a class).  I haven't added that
    here as it involves some API design.

    M ./compiler/basicTypes/DataCon.lhs -2 +12
    M ./compiler/typecheck/TcSplice.lhs -5 +22

I'm not particularly concerned about the specific API, but the following seems reasonable:

data Info
 ...
 | DataFamI Dec [DataFamInstance]
 | TypeFamI Dec [TypeFamInstance]
 ...

-- | Always a 'DataInstD' or 'NewtypeInstD' constructor
type DataFamInstance = Dec
-- | Always a 'TySynInstD' constructor
type TypeFamInstance = Dec

Alternatively, perhaps the DataFamI and TypeFamI constructors should be discarded in favour of a single FamI constructor.

Trac metadata
Trac field Value
Version 7.0.4
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Template Haskell
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking