#5406: Template Haskell: Reification of type family instances
---------------------------------+------------------------------------------
    Reporter:  reinerp           |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Component:  Template Haskell
     Version:  7.0.4             |    Keywords:                  
    Testcase:                    |   Blockedby:                  
          Os:  Unknown/Multiple  |    Blocking:                  
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
---------------------------------+------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5406>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to