
#9164: Hunt down uses of `castPtr` -------------------------------------+------------------------------------ Reporter: nomeata | Owner: Type: task | Status: new Priority: normal | Milestone: Component: libraries/base | 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): `hPutBuf` and friends are re-exported by `System.IO`.
I’d say that Ptr Word8 is fine – that is how hPutBuf uses it, and if I want to pass a Ptr Double, I have to think about whether that works. Having to call castPtr makes me think about it.
The data in the buffer returned could be any type. Now, whether we want to represent "any type" as `Ptr a` or `Ptr Word8` is debatable, but since we've had this API for a long time already, and changing it to `Ptr Word8` could break some code, I don't see a good argument for changing it. `castPtr` should be free. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9164#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler