packages feed

yaml 0.8.18.7 → 0.8.19.0

raw patch · 3 files changed

+54/−3 lines, 3 filesdep +template-haskellPVP ok

version bump matches the API change (PVP)

Dependencies added: template-haskell

API changes (from Hackage documentation)

+ Data.Yaml.TH: (.!=) :: Parser (Maybe a) -> a -> Parser a
+ Data.Yaml.TH: (.:) :: FromJSON a => Object -> Text -> Parser a
+ Data.Yaml.TH: (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)
+ Data.Yaml.TH: (.=) :: KeyValue kv => forall v. ToJSON v => Text -> v -> kv
+ Data.Yaml.TH: Array :: ~Array -> Value
+ Data.Yaml.TH: Bool :: ~Bool -> Value
+ Data.Yaml.TH: Null :: Value
+ Data.Yaml.TH: Number :: ~Scientific -> Value
+ Data.Yaml.TH: Object :: ~Object -> Value
+ Data.Yaml.TH: String :: ~Text -> Value
+ Data.Yaml.TH: array :: [Value] -> Value
+ Data.Yaml.TH: class FromJSON a
+ Data.Yaml.TH: data Parser a :: * -> *
+ Data.Yaml.TH: data Value :: *
+ Data.Yaml.TH: decodeFile :: forall a. (Lift a, FromJSON a) => FilePath -> Q (TExp a)
+ Data.Yaml.TH: object :: [Pair] -> Value
+ Data.Yaml.TH: parseJSON :: Value -> Parser a
+ Data.Yaml.TH: parseJSONList :: Value -> Parser [a]
+ Data.Yaml.TH: type Array = Vector Value
+ Data.Yaml.TH: type Object = HashMap Text Value

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.8.19.0++* Add `Data.Yaml.TH` module+ ## 0.8.18.7  * Add `O_TRUNC` when opening files
+ Data/Yaml/TH.hs view
@@ -0,0 +1,44 @@+{-# LANGUAGE LambdaCase          #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell     #-}++module Data.Yaml.TH+  ( -- * Decoding+    decodeFile+    -- * Re-exports from "Data.Yaml"+  , Value (..)+  , Parser+  , Object+  , Array+  , object+  , array+  , (.=)+  , (.:)+  , (.:?)+  , (.!=)+  , FromJSON (..)+  ) where++import Data.Yaml hiding (decodeFile)+import Language.Haskell.TH+import Language.Haskell.TH.Syntax++-- | Decode a @yaml@ file at compile time. Only available on GHC version @7.8.1@+-- or higher.+--+-- @since 0.8.19.0+--+-- ==== __Examples__+--+-- @+-- {-\# LANGUAGE TemplateHaskell \#-}+--+-- config :: Config+-- config = $$('decodeFile' "config.yaml")+-- @+decodeFile :: forall a. (Lift a, FromJSON a) => FilePath -> Q (TExp a)+decodeFile path = do+  addDependentFile path+  runIO (decodeFileEither path) >>= \case+    Left err -> fail (prettyPrintParseException err)+    Right x -> fmap TExp (lift (x :: a))
yaml.cabal view
@@ -1,5 +1,5 @@ name:            yaml-version:         0.8.18.7+version:         0.8.19.0 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov@@ -64,9 +64,12 @@                      Data.Yaml.Aeson                      Data.Yaml.Builder                      Data.Yaml.Config-                     Data.Yaml.Pretty-                     Data.Yaml.Parser                      Data.Yaml.Include+                     Data.Yaml.Parser+                     Data.Yaml.Pretty+    if impl(ghc >= 7.8.1)+      build-depends: template-haskell >= 2.8.0.0+      exposed-modules: Data.Yaml.TH     other-modules:                      Data.Yaml.Internal     ghc-options:     -Wall