storable-offset: Storable offsets for record fields

[ bsd3, ffi, library, utility ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies base (>=4.10 && <4.17) [details]
License BSD-3-Clause
Copyright 2022 Oleksii Divak
Author Oleksii Divak
Maintainer Oleksii Divak <frozenwitness@gmail.com>
Category FFI, Utility
Home page https://github.com/burningwitness/storable-offset#readme
Bug tracker https://github.com/burningwitness/storable-offset/issues
Source repo head: git clone https://github.com/burningwitness/storable-offset
Uploaded by OleksiiDivak at 2022-05-28T08:15:24Z
Distributions
Downloads 132 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-05-28 [all 1 reports]

Readme for storable-offset-0.1.0.0

[back to package description]

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)