Changes between Version 16 and Version 17 of Annotations


Ignore:
Timestamp:
Oct 29, 2009 8:33:59 PM (4 years ago)
Author:
batterseapower
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Annotations

    v16 v17  
    1717An annotations system was implemented as part of the Compiler Plugins Summer of Code project (Summer 08). It has been submitted to the HEAD, and will appear in GHC 6.12 and later.  Documentation will be available at http://www.haskell.org/ghc/docs/latest/html/users_guide/pragmas.html when that is released. 
    1818 
    19 The situation as-implemented is not well represented by the text below. The annotation system committed in the end is very simple. Basically, you can write things like this: 
     19The annotation system committed in the end is very simple. Basically, you can write things like this: 
    2020 
    2121{{{ 
     
    4343 
    4444 
    45 == Summer of Code Implementation (OLD) == 
     45== Why The Implementation Is The Way It Is == 
     46 
     47 * The interface-file loader (part of the GHC library) can't deserialise because it doesn't have an appropriate deserialiser for every type -- a client of the GHC library might be using one unknown to GHC.  That's why Serialized is a pair (TypeRep, [Word8]) 
     48 * Any particular client, such as SpecConstr, is interested in annotations of a particular type (let's say just one for now).  That type, T, is known to the client, of course. 
     49 
     50So the client can take the AnnEnv: 
     51{{{ 
     52    AnnEnv = NameEnv [Serialized] 
     53}}} 
     54 
     55and convert it to: 
     56{{{ 
     57     MyAnnEnv = NameEnv T 
     58}}} 
     59 
     60That is, find all the Serializeds whose TypeRep matches T, and deserialise them. 
     61 
     62The general function is something like: 
     63 
     64{{{ 
     65deserialiseAnnEnv :: Typeable t => ([Word8] -> t) -> AnnEnv -> NameEnv t 
     66}}} 
     67 
     68This function could be in main/Annotations.lhs. 
     69 
     70== OLD Implementation Notes == 
     71 
     72** 
    4673 
    4774In this old implementation, annotations look like this: