storable-enum: Wrapper that makes any Enum type Storable

[ bsd3, foreign, library ] [ Propose Tags ] [ Report a vulnerability ]

In foreign function interfaces you will often want to use enumeration types but defining Storable instances is cumbersome. This package provides the type Enum.Storable.T w e, where e.g. Enum.Storable.T Word8 Ordering means that values of type Ordering are stored in a Word8. The Storable methods store the numeric values of the enumeration elements as obtained by fromEnum. E.g. EQ is stored as 1. The type itself stores a Haskell enumeration element, such that GHC can apply all of its optimizations for enumerations. It is not checked, whether the storage type w is large enough to hold all admissible numeric values of e. It is also not checked, whether the storage type w supports negative values whenever the enumeration of e contains ones.

See the bool8 package for the special case of a Bool stored in a Word8.

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0
Dependencies base (>=3 && <5), prelude-compat (>=0.0 && <0.0.1) [details]
Tested with ghc ==7.4.2, ghc ==8.6.5
License BSD-3-Clause
Author Henning Thielemann
Maintainer haskell@henning-thielemann.de
Category Foreign
Source repo this: darcs get http://hub.darcs.net/thielema/storable-enum --tag 0.0
head: darcs get http://hub.darcs.net/thielema/storable-enum
Uploaded by HenningThielemann at 2019-10-08T15:52:20Z
Distributions NixOS:0.0
Reverse Dependencies 3 direct, 6 indirect [details]
Downloads 676 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-10-08 [all 1 reports]