Opened 13 months ago

Last modified 10 months ago

#15653 new bug

Both `Ptr a` in SerializedCompact are inaccurate because of the `a`

Reported by: chessai Owned by: ezyang
Priority: normal Milestone: 8.10.1
Component: libraries/compact Version: 8.4.3
Keywords: ghc-compact, compact regions Cc: ezyang, andrewthad
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect API annotation Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


SerializedCompactPtr is defined as:

data SerializedCompact a = SerializedCompact
  { serializedCompactBlockList :: [(Ptr a, Word)]
  , serializedCompactRoot :: Ptr a

But, these Ptr a values are a lie, because they don't point to something of type 'a', which makes the documentation for ghc-compact sort of confusing to look at. A more accurate type would just be Addr.

The consequences of this being changes to Addr are 1: breaking API changes (though not many people use compact regions) 2: A dependency on primitive would be necessary, though I'm again unsure how big of a deal this is, given that ghc-compact already depends on bytestring. (Addr should probably be moved to base, and re-exported from primitive, which would avoid this issue.)

Change History (2)

comment:1 Changed 13 months ago by bgamari

I think it would be quite reasonable to fix this. In my view we should try quite hard to ensure unsafe interfaces like that of Ptr are made as safe as possible.

comment:2 Changed 10 months ago by osa1


Bumping milestones of low-priority tickets.

Note: See TracTickets for help on using tickets.