Skip to content
  • Simon Peyton Jones's avatar
    Add (a) CoreM monad, (b) new Annotations feature · 9bcd95ba
    Simon Peyton Jones authored
    This patch, written by Max Bolingbroke,  does two things
    
    1.  It adds a new CoreM monad (defined in simplCore/CoreMonad),
        which is used as the top-level monad for all the Core-to-Core
        transformations (starting at SimplCore).  It supports
           * I/O (for debug printing)
           * Unique supply
           * Statistics gathering
           * Access to the HscEnv, RuleBase, Annotations, Module
        The patch therefore refactors the top "skin" of every Core-to-Core
        pass, but does not change their functionality.
    
    2.  It adds a completely new facility to GHC: Core "annotations".
        The idea is that you can say
           {#- ANN foo (Just "Hello") #-}
        which adds the annotation (Just "Hello") to the top level function
        foo.  These annotations can be looked up in any Core-to-Core pass,
        and are persisted into interface files.  (Hence a Core-to-Core pass
        can also query the annotations of imported things.)  Furthermore,
        a Core-to-Core pass can add new annotations (eg strictness info)
        of its own, which can be queried by importing modules.
    
    The design of the annotation system is somewhat in flux.  It's
    designed to work with the (upcoming) dynamic plug-ins mechanism,
    but is meanwhile independently useful.
    
    Do not merge to 6.10!  
    9bcd95ba