HList-0.4.1.0: Heterogeneous lists

Safe HaskellNone
LanguageHaskell2010

Data.HList.MakeLabels

Contents

Description

 

Synopsis

Documentation

makeLabels :: [String] -> Q [Dec] Source

Labels like Data.HList.Label5.

The following TH declaration splice should be placed at top-level, before the created values are used. Enable -XTemplateHaskell too.

 makeLabels ["getX","getY","draw","X"]

should expand into the following declarations

data LabelGetX deriving Typeable
data LabelGetY deriving Typeable
data LabelDraw deriving Typeable
data LabelX deriving Typeable
getX = Label :: Label LabelGetX
getY = Label :: Label LabelGetY
draw = Label :: Label LabelDraw
x    = Label :: Label LabelX

makeLabels3 Source

Arguments

:: String

namespace

-> [String]

labels

-> Q [Dec] 

labels using kind Symbol

makeLabels6 :: [String] -> Q [Dec] Source

for Data.HList.Label6

makeLabels6 ["x","y"]

is a shortcut for

x = Label :: Label "x"
y = Label :: Label "y"

makeLabelable :: String -> Q [Dec] Source

makeLabelable "x y z" expands out to

x = hLens' (Label :: Label "x")
y = hLens' (Label :: Label "y")
z = hLens' (Label :: Label "z")

Refer to Data.HList.Labelable for usage.