storable-offset: Storable offsets for record fields

[ bsd3, ffi, library, utility ] [ Propose Tags ]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS]
Dependencies base (>=4.10 && <4.17) [details]
License BSD-3-Clause
Copyright 2022 Oleksii Divak
Author Oleksii Divak
Maintainer Oleksii Divak <>
Category FFI, Utility
Home page
Bug tracker
Source repo head: git clone
Uploaded by OleksiiDivak at 2022-05-28T08:15:24Z
Downloads 112 total (4 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-

[back to package description]


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)