Frames-0.7.4: Data frames for working with tabular data files
Safe HaskellSafe-Inferred
LanguageHaskell2010

Frames.Categorical

Description

Support for representing so-called categorical variables: a (usually small) finite set of textual values. We map these onto regular Haskell data types and offer help to generate useful type class instances for such types.

Synopsis

Documentation

newtype Categorical (n :: Nat) Source #

A categorical variable can take on one of a finite number of textual names. Any value of type Categorical n has no more than n variants.

Constructors

Categorical 

Fields

Instances

Instances details
KnownNat n => Parseable (Categorical n) Source # 
Instance details

Defined in Frames.Categorical

Show (Categorical n) Source # 
Instance details

Defined in Frames.Categorical

Eq (Categorical n) Source # 
Instance details

Defined in Frames.Categorical

cap :: String -> String Source #

Ensure the first character of a String is uppercase.

unboxDecls :: String -> Int -> DecsQ Source #

Helper for working with derivingUnbox. Takes the name of the type and the number of variants in the sum type in order to determine a compact representation.

declareCategorical :: String -> Maybe String -> [String] -> Q [Dec] Source #

Generate a splice with data type declaration and associated instances for type suitable for representing a categorical variable. This is a type that maps between a finite set of textual names and Haskell data constructors. Usage: declareCategorical typeName optionalConPrefix variantNames will produce a data type with name typeName and data constructors whose names are a concatenation of optionalConPrefix and each element of variantNames.