Opened 18 months ago

Closed 17 months ago

Last modified 17 months ago

#14996 closed bug (invalid)

Typed holes are very slow

Reported by: simonpj Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.2.2
Keywords: TypedHoles Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #14969, #15007 Differential Rev(s):
Wiki Page:

Description

If you type at the GHCi prompt

ghci> 3 _ 4

(which I did for #14969), you get a multi-second pause before the error message comes out.

I think this is because the error-message generator is looking through the entire type environment. But it's really too slow.

Change History (6)

comment:1 Changed 18 months ago by simonpj

Keywords: TypedHoles added

comment:2 Changed 18 months ago by monoidal

Another issue is this:

$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.5.20180403: http://www.haskell.org/ghc/  :? for help
Prelude> 1
1
Prelude> 1
1
Prelude> _

<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: []

(giving "1" twice is needed to reproduce the error)

Last edited 18 months ago by monoidal (previous) (diff)

comment:3 in reply to:  2 Changed 18 months ago by sighingnow

Replying to monoidal:

Another issue is this:

<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: []

(giving "1" twice is needed to reproduce the error)

I think it's just a variant of ticket:11547, since the patch Phab:D2447 has been reverted in ticket:14052.

comment:4 Changed 18 months ago by osa1

The error in comment:2 is a different issue than the performance issue so we should deal with it in another ticket.

Edit: I can't reproduce it:

$ ./inplace/bin/ghc-stage2 --interactive
GHCi, version 8.5.20180402: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/omer/rcbackup/.ghci
λ:1> _

<interactive>:1:1: error:
    • Found hole: _ :: t
      Where: ‘t’ is a rigid type variable bound by
               the inferred type of it :: t
               at <interactive>:1:1
    • In the expression: _
      In an equation for ‘it’: it = _
    • Relevant bindings include it :: t (bound at <interactive>:1:1)
      Valid substitutions include
        undefined :: forall a. GHC.Stack.Types.HasCallStack => a
          (imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
Last edited 18 months ago by osa1 (previous) (diff)

comment:5 Changed 17 months ago by RyanGlScott

Resolution: invalid
Status: newclosed

Oops, I accidentally converted #14969 to be about the performance issue before seeing this ticket. I think I'll keep #14969 the way it is and close this in favor of a new ticket, #15037, about the issue in comment:2

And yes, to reiterate what monoidal said, you do need to run 1 twice in GHCi before running _, or else it won't be triggered.

comment:6 Changed 17 months ago by RyanGlScott

Sorry, #15007, not #15037.

Note: See TracTickets for help on using tickets.