# Revision history for hs-bindgen-runtime
## 1.0.0.0 -- 2026-10-08
### Breaking changes
* Drop support for GHC 9.2.
* The modules supporting generated code have been renamed from
`HsBindgen.Runtime.Internal.*` to `HsBindgen.Runtime.Support.*`, and their
contents have changed. Bindings generated by earlier versions of
`hs-bindgen` must be regenerated.
* `zeroUnionValue` is no longer exported from `HsBindgen.Runtime.Prelude`. Use
`zero` from the new `IsUnion` class instead. See [issue #2060][is-2060] and
[PR #2091][pr-2091].
### New features
* Add a new `HsBindgen.Runtime.HasFFIType` module with the `HasFFIType` class,
which maps types to the types used in `foreign import` argument and result
positions. The class is open: users can write their own instances, e.g. for
types referenced by external binding specifications. The module also exports
`PtrVoid`, `FunPtrVoid` and the deriving helper `ViaIdentity`. See [PR
#2267][pr-2267].
* Add a new `HsBindgen.Runtime.Union` module for C unions. Generated union
types are newtypes around a byte array, so their fields cannot be accessed
through a data constructor. The `IsUnion` class has the single method
`zero`, the union value whose bytes are all zero. A union value is
constructed by setting one field of `zero`, either with `set` or by a record
update (see `HsBindgen.Runtime.Overloading`); `get` reads a field. The module
also exports the deriving helper `IsUnionViaReadRaw`. See [issue
#2060][is-2060] and [PR #2091][pr-2091].
* Add a new `HsBindgen.Runtime.Struct` module with the `IsStruct` class for C
structs (currently with the single method `zero`) and the deriving
helper `IsStructViaReadRaw`. See [issue #2121][is-2121] and [PR
#2164][pr-2164].
* Add a new `HsBindgen.Runtime.Overloading` module that re-exports the
functions the `RebindableSyntax` language extension takes out of scope (such
as `fromString`, `ifThenElse`, `getField`, and `setField`).
`RebindableSyntax` is required for overloaded record updates. See [issue
#2085][is-2085] and [PR #2168][pr-2168].
* Add a new `HsBindgen.Runtime.Macro` module providing `Raw`, the type of macros
that are kept as their token spellings only, rather than typechecked. See
[issue #2242][is-2242].
### Minor changes
* `HsBindgen.Runtime.Prelude` additionally exports `IsStruct`, `IsUnion`, and
`WithFlam` (opaque).
* `HsBindgen.Runtime.LibC` exports the data constructors of `CTime` and
`CClock`.
### Bug fixes
* Fix bit-field writes (`BitfieldPtr.poke`, `HasCBitfield`) that could write
more bytes than necessary. See [PR #2169][pr-2169].
* Setting a union field no longer zeroes the bytes outside the field; only the
bytes belonging to the field are modified. See [issue #2183][is-2183].
[is-2060]: https://github.com/well-typed/hs-bindgen/issues/2060
[is-2085]: https://github.com/well-typed/hs-bindgen/issues/2085
[is-2121]: https://github.com/well-typed/hs-bindgen/issues/2121
[is-2183]: https://github.com/well-typed/hs-bindgen/issues/2183
[is-2242]: https://github.com/well-typed/hs-bindgen/issues/2242
[pr-2091]: https://github.com/well-typed/hs-bindgen/pull/2091
[pr-2164]: https://github.com/well-typed/hs-bindgen/pull/2164
[pr-2168]: https://github.com/well-typed/hs-bindgen/pull/2168
[pr-2169]: https://github.com/well-typed/hs-bindgen/pull/2169
[pr-2267]: https://github.com/well-typed/hs-bindgen/pull/2267
## 0.1.0-alpha2 -- 2026-03-27
### Breaking changes
* Remove `withPtr` for `IncompleteArray` and `ConstArray`. Use `withElemPtr`
from the `IsArray` class instead. See [PR #1712][pr-1712].
* The `BitfieldPtr` constructor pattern is removed, making the type opaque. A
smart constructor and accessor functions are exported instead.
* `StaticSize` constraints are added to `HasCBitfield` API functions, in order
to calculate memory bounds. This enables single `peek`/`poke` reads/writes
when possible while ensuring that neighboring memory is not accessed.
### New features
* Add new `safeCastFunPtr` function to `HsBindgen.Runtime.Prelude`.
* Improve documentation and fix documentation-related warnings.
* Add new `IsArray` class with instances for `IncompleteArray` and
`ConstArray`. See [PR #1712][pr-1712].
### Minor changes
* Add an internal prelude, re-exporting all definitions required by `hs-bindgen`
generated code.
* Remove `TypeEquality` module and `TyEq`. Use built-in `(~)` or operator
`(~)` (for later versions of GHC; implicitly imported from `Prelude`).
* Do not export `intVal` from `HsBindgen.Runtime.ConstantArray`.
### Bug fixes
* Rewrite bit-field `peek` and `poke` code to read to and write from the correct
locations in memory, support packed `struct` fields that cross machine word
boundaries, and only use aligned reads/writes so that it is safe across all
architectures
* Fix `loMask @Int64 64`, which was returning an incorrect mask
[pr-1712]: https://github.com/well-typed/hs-bindgen/pull/1712
## 0.1.0-alpha -- 2026-02-06
* First public pre-release.