[GHC] #13908: sameMutableArray equivalent for Array

GHC ghc-devs at haskell.org
Fri Jul 7 17:41:24 UTC 2017


#13908: sameMutableArray equivalent for Array
-------------------------------------+-------------------------------------
        Reporter:  winter            |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  wontfix           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3697
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 Actually, in its current form I realized that `reallyUnsafePtrEquality#`
 doesn't really fit the bill: it's type is `Type -> Type -> Int#` whereas
 `ByteArray#` is of kind `TYPE 'UnliftedPtrRep`. This means that you would
 first need to coerce the `ByteArray#` to a lifted type before being able
 to do the comparison, which seems quite ugly.

 Ideally we would be able to make the type of `reallyUnsafePtrEquality#`
 `TYPE ('PtrRep levity) -> TYPE ('PtrRep levity) -> Int#`, abstracting over
 levity. In the short term we could also introduce a
 `reallyUnsafeUnliftedPtrEquality# :: TYPE 'UnliftedPtrRep -> TYPE
 'UnliftedPtrRep -> Int#`, but frankly I think the `unsafeCoerce#` is
 probably a reasonable 80% solution for the time being.

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


More information about the ghc-tickets mailing list