patch applied (ghc): Add non-recursive let-bindings for types

Simon Peyton Jones simonpj at microsoft.com
Thu Jun 5 08:50:31 EDT 2008


Thu Jun  5 05:36:12 PDT 2008  simonpj at microsoft.com
  * Add non-recursive let-bindings for types
  
  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.
  
  

    M ./compiler/coreSyn/CoreLint.lhs -69 +27
    M ./compiler/coreSyn/CoreSyn.lhs -4 +19
    M ./compiler/coreSyn/PprCore.lhs +2
    M ./compiler/deSugar/DsUtils.lhs -3 +3
    M ./compiler/simplCore/OccurAnal.lhs -1 +4
    M ./compiler/simplCore/Simplify.lhs -10 +5

View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20080605123612-1287e-36a1c87b9d9945ba6711a9d185ae62097c6f1ab1.gz



More information about the Cvs-ghc mailing list