on master help sign in
Only compile Data.Yaml.TH on ghc >= 7.8.1
commitab14a8926304412d1ba400829389ccf8e72b80bd authorMitchell Rosen <mitchellwrosen@gmail.com> dateSat 15 Oct 2016, 13:32 (10 years ago) parentb082df6
2 files changed+10−6
Data/Yaml/TH.hs+8−5 yaml.cabal+2−1
Data/Yaml/TH.hs+8−5
@@ -23,19 +23,22 @@ import Data.Yaml hiding (decodeFile)
2323import Language.Haskell.TH
2424import Language.Haskell.TH.Syntax
2525
26−-- | Decode a @yaml@ file at compile time.
26+-- | Decode a @yaml@ file at compile time. Only available on GHC version @7.8.1@
27+-- or higher.
28+--
29+-- @since 0.8.19.0
30+--
31+-- ==== __Examples__
2732--
2833-- @
29−-- {-# LANGUAGE TemplateHaskell #-}
34+-- {-\# LANGUAGE TemplateHaskell \#-}
3035--
3136-- config :: Config
3237-- config = $$('decodeFile' "config.yaml")
3338-- @
34−--
35−-- @since 0.8.19.0
3639decodeFile :: forall a. (Lift a, FromJSON a) => FilePath -> Q (TExp a)
3740decodeFile path = do
3841 addDependentFile path
3942 runIO (decodeFileEither path) >>= \case
4043 Left err -> fail (prettyPrintParseException err)
41− Right x -> TExp <$> lift (x :: a)
44+ Right x -> fmap TExp (lift (x :: a))
yaml.cabal+2−1
@@ -68,7 +68,8 @@ library
6868 Data.Yaml.Include
6969 Data.Yaml.Parser
7070 Data.Yaml.Pretty
71− Data.Yaml.TH
71+ if impl(ghc >= 7.8.1)
72+ exposed-modules: Data.Yaml.TH
7273 other-modules:
7374 Data.Yaml.Internal
7475 ghc-options: -Wall