Opened 10 years ago

Closed 10 years ago

Last modified 9 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


: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 10 years ago by igloo

Component: CompilerGHCi

comment:2 Changed 10 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 10 years ago by mnislaih

Cc: mnislaih@… added

comment:4 Changed 10 years ago by igloo

Resolution: fixed
Status: newclosed

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 10 years ago by simonmar

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

comment:6 Changed 10 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 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:8 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple
Note: See TracTickets for help on using tickets.