Skip to content
  • Simon Peyton Jones's avatar
    Add non-recursive let-bindings for types · 1b1190e0
    Simon Peyton Jones authored
    This patch adds to Core the ability to say
    	let a = Int in <body>
    where 'a' is a type variable.  That is: a type-let.
    See Note [Type let] in CoreSyn.
    
    * The binding is always non-recursive
    * The simplifier immediately eliminates it by substitution 
    
    So in effect a type-let is just a delayed substitution.  This is convenient
    in a couple of places in the desugarer, one existing (see the call to
    CoreTyn.mkTyBind in DsUtils), and one that's in the next upcoming patch.
    
    The first use in the desugarer was previously encoded as
    	(/\a. <body>) Int
    rather that eagerly substituting, but that was horrid because Core Lint
    had do "know" that a=Int inside <body> else it would bleat.  Expressing
    it directly as a 'let' seems much nicer.
    
    1b1190e0