malloc :: Storable a => IO (Ptr a)
malloc = doMalloc undefined
where
- doMalloc :: Storable a => a -> IO (Ptr a)
+ doMalloc :: Storable b => b -> IO (Ptr b)
doMalloc dummy = mallocBytes (sizeOf dummy)
-- |Allocate a block of memory of the given number of bytes.
alloca :: Storable a => (Ptr a -> IO b) -> IO b
alloca = doAlloca undefined
where
- doAlloca :: Storable a => a -> (Ptr a -> IO b) -> IO b
+ doAlloca :: Storable a' => a' -> (Ptr a' -> IO b') -> IO b'
doAlloca dummy = allocaBytes (sizeOf dummy)
-- |@'allocaBytes' n f@ executes the computation @f@, passing as argument
realloc :: Storable b => Ptr a -> IO (Ptr b)
realloc = doRealloc undefined
where
- doRealloc :: Storable b => b -> Ptr a -> IO (Ptr b)
+ doRealloc :: Storable b' => b' -> Ptr a' -> IO (Ptr b')
doRealloc dummy ptr = let
size = fromIntegral (sizeOf dummy)
in