[project @ 1999-03-05 10:21:22 by sof]
[ghc-hetmet.git] / ghc / lib / std / PrelArr.lhs
index 331bc26..5f93a93 100644 (file)
@@ -637,4 +637,12 @@ thawArray (Array ixs arr#) = ST $ \ s# ->
              case writeArray# to#   cur# ele st# of { s1# ->
              copy (cur# +# 1#) end# from# to# s1#
              }}
+
+-- this is a quicker version of the above, just flipping the type
+-- (& representation) of an immutable array. And placing a
+-- proof obligation on the programmer.
+unsafeThawArray :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt)
+unsafeThawArray (Array ixs arr#) = ST $ \ s# ->
+   case unsafeThawArray# arr# s# of
+      (# s2#, marr# #) -> (# s2#, MutableArray ixs marr# #)
 \end{code}