Ptr type

Simon Peyton Jones simonpj at microsoft.com
Tue Jun 3 11:13:19 UTC 2014


Richard
In GHC.Ptr we see

type role Ptr representational

data Ptr a = Ptr Addr# deriving (Eq, Ord)
with no comments.  Why is Ptr representational?
In the same module we have castPtr, which unpacks and repacks a Ptr.  If Ptr was phantom, we could use coerce.  And that in turn would actually make a lot of code more efficient - there are lots of calls to castPtr.
Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140603/6cfed09d/attachment.html>


More information about the ghc-devs mailing list