Description
Storable offsets for record fields.
Description
Please see the README on GitHub at https://github.com/burningwitness/storable-offset#readme
README.md
storable-offset
Tiny helper library that provides a way to access fields of Storable
data structures.
Given an instance
{-# LANGUAGE DataKinds
, MultiParamTypeClasses #-}
instance Offset "fieldName" DataType where rawOffset = #{offset data_type, field_name}
, you can now peek
/poke fieldName
directly using
{-# LANGUAGE TypeApplications #-}
peek $ offset @"fieldName" (ptr @DataType)
poke (offset @"fieldName" ptr) (val @DataType)