on master help sign in
GHC 7.6.3 compat
7f1aaa1Simon Hengel
Data/Yaml/TH.hs+7−2
@@ -1,10 +1,13 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
3
4
4module Data.Yaml.TH
5module Data.Yaml.TH
5 ( -- * Decoding
6 ( -- * Decoding
6− decodeFile
7− , yamlQQ
7+ yamlQQ
8+#if MIN_VERSION_template_haskell(2,9,0)
9+ , decodeFile
10+#endif
8 -- * Re-exports from "Data.Yaml"
11 -- * Re-exports from "Data.Yaml"
9 , Value (..)
12 , Value (..)
10 , Parser
13 , Parser
@@ -27,6 +30,7 @@ import Language.Haskell.TH.Quote
27
30
28import Data.Yaml hiding (decodeFile)
31import Data.Yaml hiding (decodeFile)
29
32
33+#if MIN_VERSION_template_haskell(2,9,0)
30-- | 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@
31-- or higher.
35-- or higher.
32--
36--
@@ -46,6 +50,7 @@ decodeFile path = do
46 runIO (decodeFileEither path) >>= \case
50 runIO (decodeFileEither path) >>= \case
47 Left err -> fail (prettyPrintParseException err)
51 Left err -> fail (prettyPrintParseException err)
48 Right x -> fmap TExp (lift (x :: a))
52 Right x -> fmap TExp (lift (x :: a))
53+#endif
49
54
50decodeValue :: String -> Either String Value
55decodeValue :: String -> Either String Value
51decodeValue = decodeEither . encodeUtf8 . T.pack
56decodeValue = decodeEither . encodeUtf8 . T.pack
yaml.cabal+3−3
@@ -60,6 +60,7 @@ library
60 , filepath
60 , filepath
61 , directory
61 , directory
62 , semigroups
62 , semigroups
63+ , template-haskell
63 exposed-modules: Text.Libyaml
64 exposed-modules: Text.Libyaml
64 Data.Yaml
65 Data.Yaml
65 Data.Yaml.Aeson
66 Data.Yaml.Aeson
@@ -68,9 +69,7 @@ library
68 Data.Yaml.Include
69 Data.Yaml.Include
69 Data.Yaml.Parser
70 Data.Yaml.Parser
70 Data.Yaml.Pretty
71 Data.Yaml.Pretty
71− if impl(ghc >= 7.8.1)
72− build-depends: template-haskell >= 2.8.0.0
73− exposed-modules: Data.Yaml.TH
72+ Data.Yaml.TH
74 other-modules:
73 other-modules:
75 Data.Yaml.Internal
74 Data.Yaml.Internal
76 ghc-options: -Wall
75 ghc-options: -Wall
@@ -126,6 +125,7 @@ test-suite spec
126 main-is: Spec.hs
125 main-is: Spec.hs
127 other-modules: Data.YamlSpec
126 other-modules: Data.YamlSpec
128 Data.Yaml.IncludeSpec
127 Data.Yaml.IncludeSpec
128+ Data.Yaml.THSpec
129 cpp-options: -DTEST
129 cpp-options: -DTEST
130 build-depends: hspec >= 1.3
130 build-depends: hspec >= 1.3
131 , HUnit
131 , HUnit