@@ -829,13 +829,19 @@ fromPureStream x = unsafePerformIO $ fmap (unsafeFreeze) (MA.fromPureStream x)
829-- fromPureStream = runIdentity . D.fold (unsafeMakePure write)
829-- fromPureStream = runIdentity . D.fold (unsafeMakePure write)
830-- fromPureStream = fromList . runIdentity . D.toList
830-- fromPureStream = fromList . runIdentity . D.toList
832+-- XXX This should be monadic.
832-- | Copy an immutable 'Ptr Word8' sequence into an array.
834-- | Copy an immutable 'Ptr Word8' sequence into an array.
834-- /Unsafe:/ The caller is responsible for safe addressing.
836-- /Unsafe:/ The caller is responsible for safe addressing.
838+-- Note that this should be evaluated strictly to ensure that we do not hold
839+-- the reference to the pointer in a lazy thunk.
836fromPtrN :: Int -> Ptr Word8 -> Array Word8
840fromPtrN :: Int -> Ptr Word8 -> Array Word8
837fromPtrN n addr = unsafePerformIO $ fmap unsafeFreeze (MA.fromPtrN n addr)
841fromPtrN n addr = unsafePerformIO $ fmap unsafeFreeze (MA.fromPtrN n addr)
843+-- XXX This should be monadic.
839-- | Copy a null terminated immutable 'Addr#' Word8 sequence into an array.
845-- | Copy a null terminated immutable 'Addr#' Word8 sequence into an array.
841-- /Unsafe:/ The caller is responsible for safe addressing.
847-- /Unsafe:/ The caller is responsible for safe addressing.
@@ -846,9 +852,15 @@ fromPtrN n addr = unsafePerformIO $ fmap unsafeFreeze (MA.fromPtrN n addr)
846-- >>> Array.toList $ Array.fromByteStr# "\1\2\3\0"#
852-- >>> Array.toList $ Array.fromByteStr# "\1\2\3\0"#
847-- [1,2,3]
853-- [1,2,3]
855+-- Note that this should be evaluated strictly to ensure that we do not hold
856+-- the reference to the pointer in a lazy thunk.
849fromByteStr# :: Addr# -> Array Word8
857fromByteStr# :: Addr# -> Array Word8
850fromByteStr# addr = unsafePerformIO $ fmap unsafeFreeze (MA.fromByteStr# addr)
858fromByteStr# addr = unsafePerformIO $ fmap unsafeFreeze (MA.fromByteStr# addr)
860+-- XXX This should be monadic.
862+-- | Note that this should be evaluated strictly to ensure that we do not hold
863+-- the reference to the pointer in a lazy thunk.
852fromByteStr :: Ptr Word8 -> Array Word8
864fromByteStr :: Ptr Word8 -> Array Word8
853fromByteStr (Ptr addr#) = fromByteStr# addr#
865fromByteStr (Ptr addr#) = fromByteStr# addr#