@@ -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