@@ -184,42 +184,42 @@ unpin arr@(MutableByteArray marr#) =
184184class Storable a => Unbox a where
185185 -- | Read an element of type "a" from a MutableByteArray given the byte
186186 -- index.
187− box :: MutableByteArray a -> Int -> IO a
187+ peekByteIndex :: MutableByteArray a -> Int -> IO a
188188 -- | Write an element of type "a" to a MutableByteArray given the byte
189189 -- index.
190− unbox :: MutableByteArray a -> Int -> a -> IO ()
190+ pokeByteIndex :: MutableByteArray a -> Int -> a -> IO ()
191191
192192#define DERIVE_UNBOXED(_type, _constructor, _readArray, _writeArray) \
193193instance Unbox _type where { \
194−; {-# INLINE box #-} \
195−; box (MutableByteArray mbarr) (I# n) = IO $ \s -> \
194+; {-# INLINE peekByteIndex #-} \
195+; peekByteIndex (MutableByteArray mbarr) (I# n) = IO $ \s -> \
196196 case _readArray mbarr n s of \
197197 { (# s1, i #) -> (# s1, _constructor i #) } \
198−; {-# INLINE unbox #-} \
199−; unbox (MutableByteArray mbarr) (I# n) (_constructor val) = \
198+; {-# INLINE pokeByteIndex #-} \
199+; pokeByteIndex (MutableByteArray mbarr) (I# n) (_constructor val) = \
200200 IO $ \s -> (# _writeArray mbarr n val s, () #) \
201201}
202202
203203#define DERIVE_WRAPPED_UNBOX(_constraint, _type, _constructor) \
204204instance _constraint Unbox _type where \
205−; {-# INLINE box #-} \
206−; box arr i = _constructor <$> box (castContents arr) i \
207−; {-# INLINE unbox #-} \
208−; unbox arr i (_constructor a) = unbox (castContents arr) i a
205+; {-# INLINE peekByteIndex #-} \
206+; peekByteIndex arr i = _constructor <$> peekByteIndex (castContents arr) i \
207+; {-# INLINE pokeByteIndex #-} \
208+; pokeByteIndex arr i (_constructor a) = pokeByteIndex (castContents arr) i a
209209
210210#define DERIVE_BINARY_UNBOX(_constraint, _type, _constructor, _innerType) \
211211instance _constraint Unbox _type where { \
212−; {-# INLINE box #-} \
213−; box arr i = \
212+; {-# INLINE peekByteIndex #-} \
213+; peekByteIndex arr i = \
214214 let contents = castContents arr :: MutableByteArray _innerType \
215− in box contents i >>= \
216− (\p1 -> box contents (i + SIZE_OF(_innerType)) \
215+ in peekByteIndex contents i >>= \
216+ (\p1 -> peekByteIndex contents (i + SIZE_OF(_innerType)) \
217217 <&> _constructor p1) \
218−; {-# INLINE unbox #-} \
219−; unbox arr i (_constructor p1 p2) = \
218+; {-# INLINE pokeByteIndex #-} \
219+; pokeByteIndex arr i (_constructor p1 p2) = \
220220 let contents = castContents arr :: MutableByteArray _innerType \
221− in unbox contents i p1 >> \
222− unbox contents (i + SIZE_OF(_innerType)) p2 \
221+ in pokeByteIndex contents i p1 >> \
222+ pokeByteIndex contents (i + SIZE_OF(_innerType)) p2 \
223223}
224224
225225DERIVE_UNBOXED( Char
@@ -315,34 +315,34 @@ DERIVE_BINARY_UNBOX(,Fingerprint,Fingerprint,Word64)
315315
316316instance Unbox () where
317317
318− {-# INLINE box #-}
319− box _ _ = return ()
318+ {-# INLINE peekByteIndex #-}
319+ peekByteIndex _ _ = return ()
320320
321− {-# INLINE unbox #-}
322− unbox _ _ _ = return ()
321+ {-# INLINE pokeByteIndex #-}
322+ pokeByteIndex _ _ _ = return ()
323323
324324#if MIN_VERSION_base(4,15,0)
325325instance Unbox IoSubSystem where
326326
327− {-# INLINE box #-}
328− box arr i = toEnum <$> box (castContents arr) i
327+ {-# INLINE peekByteIndex #-}
328+ peekByteIndex arr i = toEnum <$> peekByteIndex (castContents arr) i
329329
330− {-# INLINE unbox #-}
331− unbox arr i a = unbox (castContents arr) i (fromEnum a)
330+ {-# INLINE pokeByteIndex #-}
331+ pokeByteIndex arr i a = pokeByteIndex (castContents arr) i (fromEnum a)
332332#endif
333333
334334instance Unbox Bool where
335335
336− {-# INLINE box #-}
337− box arr i = do
338− res <- box (castContents arr) i
336+ {-# INLINE peekByteIndex #-}
337+ peekByteIndex arr i = do
338+ res <- peekByteIndex (castContents arr) i
339339 return $ res /= (0 :: Int32)
340340
341− {-# INLINE unbox #-}
342− unbox arr i a =
341+ {-# INLINE pokeByteIndex #-}
342+ pokeByteIndex arr i a =
343343 if a
344− then unbox (castContents arr) i (1 :: Int32)
345− else unbox (castContents arr) i (0 :: Int32)
344+ then pokeByteIndex (castContents arr) i (1 :: Int32)
345+ else pokeByteIndex (castContents arr) i (0 :: Int32)
346346
347347--------------------------------------------------------------------------------
348348-- Functions
@@ -350,8 +350,8 @@ instance Unbox Bool where
350350
351351{-# INLINE peekWith #-}
352352peekWith :: Unbox a => MutableByteArray a -> Int -> IO a
353−peekWith = box
353+peekWith = peekByteIndex
354354
355355{-# INLINE pokeWith #-}
356356pokeWith :: Unbox a => MutableByteArray a -> Int -> a -> IO ()
357−pokeWith = unbox
357+pokeWith = pokeByteIndex