[GHC] #9163: Ptr should have a phantom role

GHC ghc-devs at haskell.org
Tue Jun 3 14:17:22 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 goldfire):

 While I hear Austin's concerns, I tend to agree with Simon here. We don't
 want to consider `Ptr Int` and `Ptr Bool` to be the same types, but we
 ''do'' want to allow a knowledgeable programmer to get from one to the
 other for free. This seems to be a great use case for `coerce`. This idea
 extends to other cases where GHC infers phantom roles.

 In case it got lost, I'll ask again: why is `Ptr` a datatype, not a
 newtype?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9163#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list