[GHC] #13908: sameMutableArray equivalent for Array

GHC ghc-devs at haskell.org
Sat Jul 1 14:59:14 UTC 2017


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

Comment (by winter):

 I just come up a third solution to this problem:

 {{{
 sameArray :: Array a -> Array a -> Bool
 sameArray arr1 arr2 = runST (do
         return (sameMutableArray (unsafeCoerce arr1) (unsafeCoerce marr2))
 }}}

 Does this code safe? do i have to use unboxed version, e.g. unsafeCoerce#
 with array#?

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


More information about the ghc-tickets mailing list