module Sound.MED.Basic.Storable where import Foreign.Storable (Storable, peekByteOff) import Foreign.Ptr (Ptr) import Control.Applicative ((<$>)) import Data.Storable.Endian (HasBigEndian, getBigEndian) import Data.Word (Word32) type MEM = Ptr () type PTR = Word32 type Peek a = MEM -> PTR -> IO a peekOffset :: (Storable a) => Peek a peekOffset :: Peek a peekOffset MEM mem PTR ptr = MEM -> Int -> IO a forall a b. Storable a => Ptr b -> Int -> IO a peekByteOff MEM mem (PTR -> Int forall a b. (Integral a, Num b) => a -> b fromIntegral PTR ptr) peekBig :: (Storable a, HasBigEndian a) => Peek a peekBig :: Peek a peekBig MEM mem PTR ptr = BigEndian a -> a forall a. BigEndian a -> a getBigEndian (BigEndian a -> a) -> IO (BigEndian a) -> IO a forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Peek (BigEndian a) forall a. Storable a => Peek a peekOffset MEM mem PTR ptr