Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2174 closed bug (fixed)

:p in GHCi debugger is broken for Integer

Reported by: igloo Owned by:
Priority: normal Milestone: 6.10 branch
Component: GHCi Version: 6.9
Keywords: Cc: mnislaih@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

:p used to do this for Integers:

Prelude> let i = Just (10::Integer)
Prelude> :p i
i = Just 10

but it now does this:

Prelude> let i = Just (10::Integer)
Prelude> :p i
i = Just (_t1::Integer)

but I can't see an obvious reason why.

Change History (8)

comment:1 Changed 7 years ago by igloo

  • Component changed from Compiler to GHCi

comment:2 Changed 7 years ago by mnislaih

Imho there is nothing fundamentally broken with :p in this example. It just shows that GHC has become a little lazier w.r.t. Integers. I have tried but can't find the exact patch producing this change, but it seems to be due to the move of Integer into its own package.

By its nature, imho it is not reasonable to expect that the output of :print will remain the same across GHC versions, as the evaluation strategy in Haskell is not defined and GHC may change it over different versions.

comment:3 Changed 7 years ago by mnislaih

  • Cc mnislaih@… added

comment:4 Changed 7 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

OK, I now understand what's going on. We used to make S# 10#, which is fully evaluated so got printed. We now make smallInteger 10# which is not fully evaluated. So the new behaviour seems fine to me. I've updated the test accordingly.

comment:5 Changed 7 years ago by simonmar

Are we sure that nothing has regressed w.r.t. efficiency here?

comment:6 Changed 7 years ago by igloo

The definition is just

{-# INLINE smallInteger #-}
smallInteger :: Int# -> Integer
smallInteger i = S# i

so there should be no difference when compiling.

comment:7 Changed 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:8 Changed 7 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.