Safe Haskell | None |
---|---|
Language | Haskell2010 |
- makeLabels :: [String] -> Q [Dec]
- makeLabels3 :: String -> [String] -> Q [Dec]
- makeLabels6 :: [String] -> Q [Dec]
- makeLabelable :: String -> Q [Dec]
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
labels using kind Symbol
makeLabels6 :: [String] -> Q [Dec] Source #
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.