Skip to content

Commit

Permalink
Update doc and fix hlint
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Oct 11, 2024
1 parent 5798b1d commit 6b0238f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core/src/Streamly/Internal/Data/Array/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,12 @@ unsafeAsForeignPtr arr@Array{..} f =
fptr = ForeignPtr addr# fptrContents
in f fptr i

mutableByteArrayContents# :: Exts.MutableByteArray# s -> Addr#
{-# INLINE mutableByteArrayContents# #-}
mutableByteArrayContents# x =
mutableByteArrayContents# :: Exts.MutableByteArray# s -> Addr#
#if __GLASGOW_HASKELL__ >= 902
Exts.mutableByteArrayContents# x
mutableByteArrayContents# = Exts.mutableByteArrayContents#
#else
Exts.byteArrayContents# (Exts.unsafeCoerce# x)
mutableByteArrayContents# x = Exts.byteArrayContents# (Exts.unsafeCoerce# x)
#endif

-- | @unsafeFromForeignPtr fptr len@ converts the "ForeignPtr" to an "Array".
Expand Down Expand Up @@ -1024,8 +1023,6 @@ fromPureStream x = unsafePerformIO $ fmap unsafeFreeze (MA.fromPureStream x)
-- /Unsafe:/ The caller is responsible to ensure that the pointer passed is
-- valid up to the given length.
--
-- Note that this should be evaluated strictly to ensure that we do not hold
-- the reference to the pointer in a lazy thunk.
fromPtrN :: MonadIO m => Int -> Ptr Word8 -> m (Array Word8)
fromPtrN n addr = fmap unsafeFreeze (MA.fromPtrN n addr)

Expand Down

0 comments on commit 6b0238f

Please sign in to comment.