-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Storable offsets for record fields -- -- Please see the README on GitHub at -- https://github.com/burningwitness/storable-offset#readme @package storable-offset @version 0.1.0.0 -- | Utility functions for using Storable to access record fields of -- data structures. -- -- Functions in this module rely on the TypeApplications pragma -- (the Offset class itself doesn't). module Foreign.Storable.Offset class Offset (x :: Symbol) r -- | Byte distance between the start of datatype r within memory -- and its field x. rawOffset :: Offset x r => Int -- | Advances a pointer based on field's Offset, inheriting field's -- type. -- -- Resulting pointer can be used to peek or poke the field -- directly. offset :: forall x r a. (HasField x r a, Offset x r) => Ptr r -> Ptr a -- | Retrieves the field and pokes it at proper offset. -- -- Useful for declaring poke for the entire datatype. pokeField :: forall x r a. (HasField x r a, Offset x r, Storable a) => Ptr r -> r -> IO ()