 
   alignment _ = alignment (undefined :: Word32)
 
-  peek ptr = do
-    a <- fromIntegral `fmap` peekBE (castPtr ptr :: Ptr Word32)
-    b <- fromIntegral `fmap` peekBE (castPtr ptr `plusPtr` 4 :: Ptr Word32)
-    c <- fromIntegral `fmap` peekBE (castPtr ptr `plusPtr` 8 :: Ptr Word32)
-    return $ ArchiveInfo a b c
+  peek ptr = ArchiveInfo
+    <$> peekWord32beAsNum (castPtr ptr)
+    <*> peekWord32beAsNum (castPtr ptr `plusPtr` 4)
+    <*> peekWord32beAsNum (castPtr ptr `plusPtr` 8)
 
   poke ptr ArchiveInfo{..} = do
     pokeBE (castPtr ptr) (fromIntegral aiOffset :: Word32)

    coerce :: Double -> Word64
    coerce x = unsafePerformIO $ with x $ \p ->
      peek (castPtr p) :: IO Word64


  alignment _ = alignment (undefined :: Word32)

  peek ptr = MetaData
    <$> peek (castPtr ptr)
    <*> peekWord32beAsNum (castPtr ptr `plusPtr` 4)
    <*> peekWord32beAsFloat (castPtr ptr `plusPtr` 8)
    <*> peekWord32beAsNum (castPtr ptr `plusPtr` 12)

  poke ptr MetaData{..} = do
    poke (castPtr ptr) mdAggregationType
