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 :: forall a. Storable a => Peek a peekOffset MEM mem PTR ptr = forall a b. Storable a => Ptr b -> Int -> IO a peekByteOff MEM mem (forall a b. (Integral a, Num b) => a -> b fromIntegral PTR ptr) peekBig :: (Storable a, HasBigEndian a) => Peek a peekBig :: forall a. (Storable a, HasBigEndian a) => Peek a peekBig MEM mem PTR ptr = forall a. BigEndian a -> a getBigEndian forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> forall a. Storable a => Peek a peekOffset MEM mem PTR ptr