on master help sign in
Add documentation for yamlQQ
2736d21Simon Hengel
Data/Yaml/TH.hs+17−1
@@ -31,7 +31,7 @@ import Language.Haskell.TH.Quote
31import Data.Yaml hiding (decodeFile)
31import Data.Yaml hiding (decodeFile)
32
32
33#if MIN_VERSION_template_haskell(2,9,0)
33#if MIN_VERSION_template_haskell(2,9,0)
34−-- | Decode a @yaml@ file at compile time. Only available on GHC version @7.8.1@
34+-- | Decode a YAML file at compile time. Only available on GHC version @7.8.1@
35-- or higher.
35-- or higher.
36--
36--
37-- @since 0.8.19.0
37-- @since 0.8.19.0
@@ -60,6 +60,22 @@ yamlExp input = case decodeValue input of
60 Left err -> fail err
60 Left err -> fail err
61 Right a -> lift a
61 Right a -> lift a
62
62
63+-- | A @QuasiQuoter@ for YAML.
64+--
65+-- @since 0.8.28.0
66+--
67+-- ==== __Examples__
68+--
69+-- @
70+-- {-\# LANGUAGE QuasiQuotes \#-}
71+-- import Data.Yaml.TH
72+--
73+-- value :: Value
74+-- value = [yamlQQ|
75+-- name: John Doe
76+-- age: 23
77+-- |]
78+-- @
63yamlQQ :: QuasiQuoter
79yamlQQ :: QuasiQuoter
64yamlQQ = QuasiQuoter {
80yamlQQ = QuasiQuoter {
65 quoteExp = yamlExp
81 quoteExp = yamlExp