
3 Nov
2018
3 Nov
'18
2:56 a.m.
On Fri, 26 Oct 2018, Henning Thielemann wrote:
There are the Storable methods
peekByteOff :: Ptr b -> Int -> IO a pokeByteOff :: Ptr b -> Int -> a -> IO ()
They ignore the target types of their pointers. Should be Addr, then, too?
Thinking about it ... these functions are intended for access of record fields. Then the following type signatures would have been better: peekField :: Ptr b -> Offset b a -> IO a pokeField :: Ptr b -> Offset b a -> a -> IO () newtype Offset b a = Offset Int This way we had more type safety and no need for Addr or lying Ptr's.