• simonpj's avatar
    [project @ 2001-02-20 09:40:43 by simonpj] · 5e624292
    simonpj authored
    Decoupling the Prelude [HsExpr, HsLit, HsPat, ParseUtil, Parser.y, PrelNames,
    ~~~~~~~~~~~~~~~~~~~~~~  Rename, RnEnv, RnExpr, RnHsSyn, Inst, TcEnv, TcMonad,
    			TcPat, TcExpr]
    The -fno-implicit-prelude flag is meant to arrange that when you write
    	3
    you get
    	fromInt 3
    where 'fromInt' is whatever fromInt is in scope at the top level of
    the module being compiled.  Similarly for
    	* numeric patterns
    	* n+k patterns
    	* negation
    
    This used to work, but broke when we made the static/dynamic flag distinction.
    It's now tidied up a lot.  Here's the plan:
    
      - PrelNames contains sugarList :: SugarList, which maps built-in names
        to the RdrName that should replace them.  
    
      - The renamer makes a finite map :: SugarMap, which maps the built-in names
        to the Name of the re-mapped thing
    
      - The typechecker consults this map via tcLookupSyntaxId when it is doing
        numeric things
    
    At present I've only decoupled numeric syntax, since that is the main demand,
    but the scheme is much more robustly extensible than the previous method.
    
    As a result some HsSyn constructors don't need to carry names in them
    (notably HsOverLit, NegApp, NPlusKPatIn)
    5e624292