Skip to content
  • Thomas Schilling's avatar
    Use a per-session data structure for callbacks. Make 'WarnErrLogger' · 9a4607c3
    Thomas Schilling authored
    part of it.
    
    Part of the GHC API essentially represents a compilation framework.
    The difference of a *framework* as opposed to a *library* is that the
    overall structure of the functionality is pre-defined but certain
    details can be customised via callbacks.  (Also known as the Hollywood
    Principle: "Don't call us, we'll call you.")
    
    This patch introduces a per-session data structure that contains all
    the callbacks instead of adding lots of small function arguments
    whenever we want to give the user more control over certain parts of
    the API.  This should also help with future changes: Adding a new
    callback doesn't break old code since code that doesn't know about the
    new callback will use the (hopefully sane) default implementation.
    
    Overall, however, we should try and keep the number of callbacks small
    and well-defined (and provide useful defaults) and use simple library
    routines for the rest.
    9a4607c3