Skip to content

Confusing comments around SimplEnv

In GHC.Core.Opt.Simplify.Env we see the following definition:

data SimplEnv                                                                   
   = SimplEnv {                                                                  
     ----------- Static part of the environment -----------                     
      -- Static in the sense of lexically scoped,                                
      -- wrt the original expression                                             
                                                                                
         seMode      :: !SimplMode                                               
                                                                                 
         -- The current substitution                                             
       , seTvSubst   :: TvSubstEnv      -- InTyVar |--> OutType                  
       , seCvSubst   :: CvSubstEnv      -- InCoVar |--> OutCoercion              
       , seIdSubst   :: SimplIdSubst    -- InId    |--> OutExpr                  
                                                                                 
      ----------- Dynamic part of the environment -----------                    
      -- Dynamic in the sense of describing the setup where                      
      -- the expression finally ends up                                          
                                                                                 
         -- The current set of in-scope variables                                
         -- They are all OutVars, and all bound in this module                   
       , seInScope   :: !InScopeSet       -- OutVars only                        
                                                                                 
       , seCaseDepth :: !Int  -- Depth of multi-branch case alternatives         
     }
  1. Surely seCaseDepth is also statically scoped, but it resides in the dynamic section.
  2. seIdSubst also doesn't appear to be statically scoped, as it is used to inline preInlineUnconditionally bindings.

Thoughts @simonpj ?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information