on master help sign in
GHC 7.6.3 compat
commit7f1aaa1d1896a02e6c3bc3545a942a36d7b4bd60 authorSimon Hengel <sol@typeful.net> dateWed 17 Jan 2018, 00:46 (9 years ago) parentbd794fb
2 files changed+10−5
Data/Yaml/TH.hs+7−2 yaml.cabal+3−3
Data/Yaml/TH.hs+7−2
@@ -1,10 +1,13 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE LambdaCase #-}
23{-# LANGUAGE ScopedTypeVariables #-}
34
45module Data.Yaml.TH
56 ( -- * Decoding
6− decodeFile
7− , yamlQQ
7+ yamlQQ
8+#if MIN_VERSION_template_haskell(2,9,0)
9+ , decodeFile
10+#endif
811 -- * Re-exports from "Data.Yaml"
912 , Value (..)
1013 , Parser
@@ -27,6 +30,7 @@ import Language.Haskell.TH.Quote
2730
2831import Data.Yaml hiding (decodeFile)
2932
33+#if MIN_VERSION_template_haskell(2,9,0)
3034-- | Decode a @yaml@ file at compile time. Only available on GHC version @7.8.1@
3135-- or higher.
3236--
@@ -46,6 +50,7 @@ decodeFile path = do
4650 runIO (decodeFileEither path) >>= \case
4751 Left err -> fail (prettyPrintParseException err)
4852 Right x -> fmap TExp (lift (x :: a))
53+#endif
4954
5055decodeValue :: String -> Either String Value
5156decodeValue = decodeEither . encodeUtf8 . T.pack
yaml.cabal+3−3
@@ -60,6 +60,7 @@ library
6060 , filepath
6161 , directory
6262 , semigroups
63+ , template-haskell
6364 exposed-modules: Text.Libyaml
6465 Data.Yaml
6566 Data.Yaml.Aeson
@@ -68,9 +69,7 @@ library
6869 Data.Yaml.Include
6970 Data.Yaml.Parser
7071 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
7473 other-modules:
7574 Data.Yaml.Internal
7675 ghc-options: -Wall
@@ -126,6 +125,7 @@ test-suite spec
126125 main-is: Spec.hs
127126 other-modules: Data.YamlSpec
128127 Data.Yaml.IncludeSpec
128+ Data.Yaml.THSpec
129129 cpp-options: -DTEST
130130 build-depends: hspec >= 1.3
131131 , HUnit