const: Read-only mutable primitives

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Read-only mutable primitives.

This can be used for more accurate FFI bindings or simply to indicate more cleanly in your code what you are and aren't allowed to modify.

[Skip to Readme]


Versions 0, 0
Change log
Dependencies base (>=4.12 && <5), bytestring (>=0.10.8 && <0.12), primitive (>=0.7 && <0.8), ptrdiff (<0.1) [details]
License (BSD-2-Clause OR Apache-2.0)
Copyright Copyright (c) 2019-2021 Edward Kmett
Author Edward Kmett
Maintainer Edward Kmett <>
Category FFI
Home page
Source repo head: git clone
Uploaded by EdwardKmett at 2021-03-24T01:55:43Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for const-0

[back to package description]



This package provides a small shim around the data types and operations in Foreign and Data.Primitive for emulating const-correctness from a C perspective.

In the future it'd be nice to have a proper const-cast that can handle nested ConstPtr's, etc. but this suffices for my current usecases. Patches welcome!

Contact Information

Contributions and bug reports are welcome!

Please feel free to contact me through github or on the #haskell IRC channel on

-Edward Kmett