Skip to content

Weird GHCi bug

Take a look at this GHCi session:

$ ghci                                                                   
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help

type do {_}

Prelude> do {_}                                                          
                                                                         
<interactive>:1:5: error:                                                
    * Found hole: _ :: t                                                 
      Where: `t' is a rigid type variable bound by                       
               the inferred type of it :: t                              
               at <interactive>:1:1-6                                    
    * In a stmt of a 'do' block: _                                       
      In the expression: do _                                            
      In an equation for `it': it = do _                                 
    * Relevant bindings include it :: t (bound at <interactive>:1:1)     
      Valid substitutions include                                        
        undefined :: forall (a :: TYPE r).                               
                     GHC.Stack.Types.HasCallStack =>                     
                     a                                                   
          (imported from `Prelude' (and originally defined in `GHC.Err'))

looks ok

type ()

Prelude> ()                                              
()                                                            

ok

type do {_} again

Prelude> do {_}                                                          
                                                                         
<interactive>:3:5: error:                                                
    * Found hole: _ :: t                                                 
      Where: `t' is a rigid type variable bound by                       
               the inferred type of it :: t                              
               at <interactive>:3:1-6                                    
    * In a stmt of a 'do' block: _                                       
      In the expression: do _                                            
      In an equation for `it': it = do _                                 
    * Relevant bindings include it :: t (bound at <interactive>:3:1)     
      Valid substitutions include                                        
        undefined :: forall (a :: TYPE r).                               
                     GHC.Stack.Types.HasCallStack =>                     
                     a                                                   
          (imported from `Prelude' (and originally defined in `GHC.Err'))

ok, same message

type () second type

Prelude> ()                                              
()                                                            

ok,

type do {_} third time:

Prelude> do {_}                                                          
                                                                         
<interactive>:1:1: error:                                                
    GHC internal error: `Ghci1.it' is not in scope during type checking, 
but it passed the renamer                                                
    tcl_env of environment: []                                           
Prelude>                                                                 

what's happening?

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information