homepage: https://github.com/burningwitness/storable-offset#readme
changelog-type: ''
hash: 1f94d4369daea19cc27e151e90dc652b3074cc565121bb5874f5d8b9e019b3d1
test-bench-deps: {}
maintainer: Oleksii Divak <frozenwitness@gmail.com>
synopsis: Storable offsets for record fields
changelog: ''
basic-deps:
  base: '>=4.10 && <4.17'
all-versions:
- 0.1.0.0
author: Oleksii Divak
latest: 0.1.0.0
description-type: markdown
description: |
  # storable-offset

  Tiny helper library that provides a way to access fields of `Storable` data structures.

  Given an instance

  ```haskell
  {-# LANGUAGE DataKinds
             , MultiParamTypeClasses #-}

  instance Offset "fieldName" DataType where rawOffset = #{offset data_type, field_name}
  ```

  , you can now `peek`/`poke` `fieldName` directly using

  ```haskell
  {-# LANGUAGE TypeApplications #-}

  peek $ offset @"fieldName" (ptr @DataType)

  poke (offset @"fieldName" ptr) (val @DataType)
  ```
license-name: BSD-3-Clause

Update from Hackage at 2022-05-28T08:24:26Z
Update from Hackage at 2022-05-28T08:24:26Z
