generic-accessors-0.6.0.0: stringly-named getters for generic data

Safe HaskellNone
LanguageHaskell2010

Accessors

Synopsis

Documentation

class Lookup a where Source

Things which you can make a tree of labeled getters for. You should derive this using GHC.Generics.

Minimal complete definition

Nothing

data GAData a Source

Constructors

GAData String (GAConstructor a) 

Instances

data GASimpleEnum a Source

Constructors

GASimpleEnum 

Fields

eConstructors :: [String]
 
eToString :: a -> String
 
eToIndex :: a -> Int
 
eFromString :: a -> String -> Either String a
 
eFromIndex :: a -> Int -> Either String a
 

data GAField a Source

Constructors

FieldDouble (Lens' a Double) 
FieldFloat (Lens' a Float) 
FieldInt (Lens' a Int) 
FieldString (Lens' a String) 
FieldSorry

a field which is not yet supported

describeGAField :: GAField a -> String Source

Return the type of field, such as Bool, Double, String, etc.

sameFieldType :: GAField a -> GAField b -> Bool Source

Returns True if the type of fields is the same.

showTree :: AccessorTree a -> (Double -> String) -> a -> String Source

Show a tree of values

showFlat :: forall a. AccessorTree a -> Bool -> (Double -> String) -> a -> String Source

Show a list of values . True --> align the colums, False --> total mayhem