[GHC] #9163: Ptr should have a phantom role
GHC
ghc-devs at haskell.org
Tue Jun 3 17:34:30 UTC 2014
#9163: Ptr should have a phantom role
-------------------------------------+------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by simonmar):
So I've been assuming that `castPtr` was free all this time, and it turns
out it isn't! Please make it free.
We can't change the type of `hPutBuf` and friends without potentially
breaking code. There's no better choice than `Ptr a` here, because we
don't know the type of the underlying data. Making it `Ptr Word8` would
just force the caller to use `castPtr` sometimes without any benefit. e.g.
`Ptr CChar` is also a sensible choice, but it could in reality be
anything.
It does look like the two `castPtr`s in `bufWrite` are unnecessary,
though.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9163#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list