@@ -1,10 +1,13 @@
1{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE LambdaCase #-}
2{-# LANGUAGE ScopedTypeVariables #-}
3{-# LANGUAGE ScopedTypeVariables #-}
4module Data.Yaml.TH
5module Data.Yaml.TH
5 ( -- * Decoding
6 ( -- * Decoding
8+#if MIN_VERSION_template_haskell(2,9,0)
8 -- * Re-exports from "Data.Yaml"
11 -- * Re-exports from "Data.Yaml"
9 , Value (..)
12 , Value (..)
@@ -27,6 +30,7 @@ import Language.Haskell.TH.Quote
28import Data.Yaml hiding (decodeFile)
31import Data.Yaml hiding (decodeFile)
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.
@@ -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))
50decodeValue :: String -> Either String Value
55decodeValue :: String -> Either String Value
51decodeValue = decodeEither . encodeUtf8 . T.pack
56decodeValue = decodeEither . encodeUtf8 . T.pack