data-flags-0.0.3.2: A package for working with bit masks and flags in general.

Safe HaskellNone
LanguageHaskell98

Data.Flags.TH

Description

Template Haskell utils for declaring flags instances.

Synopsis

Documentation

dataBitsAsFlags :: Name -> Q [Dec] Source #

Produces Flags instance declaration for the specified instance of Bits.

dataBitsAsBoundedFlags :: Name -> Q [Dec] Source #

Produces Flags and BoundedFlags instances declarations for the specified instance of Bits.

bitmaskWrapper Source #

Arguments

:: String

Wrapping type name.

-> Name

Wrapped type name.

-> [Name]

Types to derive automatically.

-> [(String, Integer)]

Individual flags.

-> Q [Dec] 

Declare a newtype wrapper around the specified integral type and make it an instance of BoundedFlags. For each individual flag declare a constant. If a Show instance wasn't requested for automatic derivation, declare one with

show flags = "WrappingTypeName [IndividualFlags in flags]"

enumADT Source #

Arguments

:: String

Type name.

-> Name 
-> [(String, Integer)]

Enumeration elements.

-> Q [Dec] 

Declare an ADT with the specified constructors and make it an instance of Eq, Ord, Show and Storable.