Changes between Version 10 and Version 11 of TemplateHaskell/Annotations


Ignore:
Timestamp:
Oct 22, 2013 9:55:35 AM (6 months ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TemplateHaskell/Annotations

    v10 v11  
    6464 
    6565 
    66  
     66-------------------------------- 
    6767= Current implementation with typeclassses = 
    6868How is this implemented in HFlags currently?  By using typeclasses. 
     
    7171 
    7272This is ugly: we are abusing the reification of types and instances to send messages to ourselves between modules.  There should be an explicit way to do that.  This is requested in #7867. 
    73  
    74 The proposal is to make it possible to generate annotations from template haskell (when defining a flag) and read them all back via template haskell (in `$initHFlags`).  These module level annotations (in HFlags case) will then contain the info that is needed for flag parsing and `--help` generation. 
    75  
    76  
    7773 
    7874== Aside: with the current GHC, this implementation is not just ugly, but broken == 
     
    8581An easier way is to implement #1480, module reification.  If we can get the import list of every module, then HFlags can walk the tree of imports itself and gather all the flags.  The nice in this is that the compiler only needs very basic and simple support, and then the logic of traversal can be implemented in HFlags, not in the compiler.solutions, or object to both.** 
    8682 
     83------------------------------- 
     84= Design proposal =  
    8785 
     86The proposal is to make it possible to generate annotations from template haskell (when defining a flag) and read them all back via template haskell (in `$initHFlags`).  These module level annotations (in HFlags case) will then contain the info that is needed for flag parsing and `--help` generation. 
    8887 
     88Specifically, we propose to add the following new function to the `Quasi` class: 
     89{{{ 
     90class Quasi where  
     91  ...please fill in... 
     92}}} 
     93These functions behave as follows: 
     94 
     95... Fill in... 
     96 
     97--------------------------- 
    8998= Implementation status, options, questions = 
    9099