[GHC] #15653: Both `Ptr a` in SerializedCompact are inaccurate because of the `a`

#15653: Both `Ptr a` in SerializedCompact are inaccurate because of the `a` -------------------------------------+------------------------------------- Reporter: chessai | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: | Version: 8.4.3 libraries/compact | Keywords: ghc-compact, | Operating System: Unknown/Multiple compact regions | Architecture: | Type of failure: Incorrect API Unknown/Multiple | annotation Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{SerializedCompactPtr}}} is defined as: {{{#!hs 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.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15653 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15653: Both `Ptr a` in SerializedCompact are inaccurate because of the `a` -------------------------------------+------------------------------------- Reporter: chessai | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: | Version: 8.4.3 libraries/compact | Keywords: ghc-compact, Resolution: | compact regions Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect API | Unknown/Multiple annotation | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15653#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC