Hello community,
here is the log from the commit of package ghc-yaml for openSUSE:Factory checked in at 2016-05-03 09:36:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-yaml (Old)
and /work/SRC/openSUSE:Factory/.ghc-yaml.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-yaml"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-yaml/ghc-yaml.changes 2016-02-23 16:59:36.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-yaml.new/ghc-yaml.changes 2016-05-03 09:36:43.000000000 +0200
@@ -1,0 +2,12 @@
+Sat Apr 16 07:43:00 UTC 2016 - mimi.vx@gmail.com
+
+- update to 0.8.17.1
+* workaround for Cabal bug
+
+-------------------------------------------------------------------
+Tue Apr 12 10:26:04 UTC 2016 - mimi.vx@gmail.com
+
+- update to 0.8.17
+* loadYamlSettingsArgs
+
+-------------------------------------------------------------------
Old:
----
yaml-0.8.16.tar.gz
New:
----
yaml-0.8.17.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-yaml.spec ++++++
--- /var/tmp/diff_new_pack.yH3Euq/_old 2016-05-03 09:36:44.000000000 +0200
+++ /var/tmp/diff_new_pack.yH3Euq/_new 2016-05-03 09:36:44.000000000 +0200
@@ -18,7 +18,7 @@
%global pkg_name yaml
Name: ghc-yaml
-Version: 0.8.16
+Version: 0.8.17.1
Release: 0
Summary: Support for parsing and rendering YAML documents
License: BSD-3-Clause
@@ -35,6 +35,7 @@
BuildRequires: ghc-conduit-devel
BuildRequires: ghc-containers-devel
BuildRequires: ghc-enclosed-exceptions-devel
+BuildRequires: ghc-raw-strings-qq-devel
BuildRequires: ghc-resourcet-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-scientific-devel
++++++ yaml-0.8.16.tar.gz -> yaml-0.8.17.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/ChangeLog.md new/yaml-0.8.17.1/ChangeLog.md
--- old/yaml-0.8.16/ChangeLog.md 2016-02-15 10:17:58.000000000 +0100
+++ new/yaml-0.8.17.1/ChangeLog.md 2016-04-14 17:22:07.000000000 +0200
@@ -1,3 +1,15 @@
+## 0.8.17.1
+
+* Avoid bug in Cabal [#83](https://github.com/snoyberg/yaml/pull/83)
+
+## 0.8.17
+
+* `loadYamlSettingsArgs`
+
+## 0.8.16.1
+
+* Slight doc improvement
+
## 0.8.16
Add env variable parsing. `loadYamlSettings` can read config values from the environment with Yaml that specifies an env var.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/Data/Yaml/Config.hs new/yaml-0.8.17.1/Data/Yaml/Config.hs
--- old/yaml-0.8.16/Data/Yaml/Config.hs 2016-02-15 10:17:58.000000000 +0100
+++ new/yaml-0.8.17.1/Data/Yaml/Config.hs 2016-04-14 17:22:07.000000000 +0200
@@ -9,16 +9,20 @@
--
-- On a historical note, this code was taken directly from the yesod web framework's configuration module.
module Data.Yaml.Config
- ( applyCurrentEnv
- , getCurrentEnv
- , applyEnvValue
- , loadYamlSettings
+ ( -- * High-level
+ loadYamlSettings
+ , loadYamlSettingsArgs
+ -- ** EnvUsage
, EnvUsage
, ignoreEnv
, useEnv
, requireEnv
, useCustomEnv
, requireCustomEnv
+ -- * Lower level
+ , applyCurrentEnv
+ , getCurrentEnv
+ , applyEnvValue
) where
@@ -31,7 +35,7 @@
import Data.Aeson
import qualified Data.HashMap.Strict as H
import Data.Text (Text, pack)
-import System.Environment (getEnvironment)
+import System.Environment (getArgs, getEnvironment)
import Control.Arrow ((***))
import Control.Monad (forM)
import Control.Exception (throwIO)
@@ -50,6 +54,14 @@
mergeValues (Object x) (Object y) = Object $ H.unionWith mergeValues x y
mergeValues x _ = x
+-- | Override environment variable placeholders in the given @Value@ with
+-- values from the environment.
+--
+-- If the first argument is @True@, then all placeholders _must_ be provided by
+-- the actual environment. Otherwise, default values from the @Value@ will be
+-- used.
+--
+-- @since 0.8.16
applyEnvValue :: Bool -- ^ require an environment variable to be present?
-> H.HashMap Text Text -> Value -> Value
applyEnvValue requireEnv' env =
@@ -82,26 +94,62 @@
parseValue val = fromMaybe (String val) $ Y.decode $ encodeUtf8 val
+-- | Get the actual environment as a @HashMap@ from @Text@ to @Text@.
+--
+-- @since 0.8.16
getCurrentEnv :: IO (H.HashMap Text Text)
getCurrentEnv = fmap (H.fromList . map (pack *** pack)) getEnvironment
+-- | A convenience wrapper around 'applyEnvValue' and 'getCurrentEnv'
+--
+-- @since 0.8.16
applyCurrentEnv :: Bool -- ^ require an environment variable to be present?
-> Value -> IO Value
applyCurrentEnv requireEnv' orig = flip (applyEnvValue requireEnv') orig <$> getCurrentEnv
+-- | Defines how we want to use the environment variables when loading a config
+-- file. Use the smart constructors provided by this module.
+--
+-- @since 0.8.16
data EnvUsage = IgnoreEnv
| UseEnv
| RequireEnv
| UseCustomEnv (H.HashMap Text Text)
| RequireCustomEnv (H.HashMap Text Text)
-ignoreEnv, useEnv, requireEnv :: EnvUsage
+-- | Do not use any environment variables, instead relying on defaults values
+-- in the config file.
+--
+-- @since 0.8.16
+ignoreEnv :: EnvUsage
ignoreEnv = IgnoreEnv
+
+-- | Use environment variables when available, otherwise use defaults.
+--
+-- @since 0.8.16
+useEnv :: EnvUsage
useEnv = UseEnv
+
+-- | Do not use default values from the config file, but instead take all
+-- overrides from the environment. If a value is missing, loading the file will
+-- throw an exception.
+--
+-- @since 0.8.16
+requireEnv :: EnvUsage
requireEnv = RequireEnv
-useCustomEnv, requireCustomEnv :: H.HashMap Text Text -> EnvUsage
+-- | Same as 'useEnv', but instead of the actual environment, use the provided
+-- @HashMap@ as the environment.
+--
+-- @since 0.8.16
+useCustomEnv :: H.HashMap Text Text -> EnvUsage
useCustomEnv = UseCustomEnv
+
+-- | Same as 'requireEnv', but instead of the actual environment, use the
+-- provided @HashMap@ as the environment.
+--
+-- @since 0.8.16
+requireCustomEnv :: H.HashMap Text Text -> EnvUsage
requireCustomEnv = RequireCustomEnv
-- | Load the settings from the following three sources:
@@ -111,6 +159,13 @@
-- * Run time environment variables
--
-- * The default compile time config file
+--
+-- For example, to load up settings from @config/foo.yaml@ and allow overriding
+-- from the actual environment, you can use:
+--
+-- > loadYamlSettings ["config/foo.yaml"] [] useEnv
+--
+-- @since 0.8.16
loadYamlSettings
:: FromJSON settings
=> [FilePath] -- ^ run time config files to use, earlier files have precedence
@@ -141,3 +196,16 @@
case fromJSON value of
Error s -> error $ "Could not convert to AppSettings: " ++ s
Success settings -> return settings
+
+-- | Same as @loadYamlSettings@, but get the list of runtime config files from
+-- the command line arguments.
+--
+-- @since 0.8.17
+loadYamlSettingsArgs
+ :: FromJSON settings
+ => [Value] -- ^ any other values to use, usually from compile time config. overridden by files
+ -> EnvUsage -- ^ use environment variables
+ -> IO settings
+loadYamlSettingsArgs values env = do
+ args <- getArgs
+ loadYamlSettings args values env
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/Data/Yaml.hs new/yaml-0.8.17.1/Data/Yaml.hs
--- old/yaml-0.8.16/Data/Yaml.hs 2016-02-15 10:17:58.000000000 +0100
+++ new/yaml-0.8.17.1/Data/Yaml.hs 2016-04-14 17:22:07.000000000 +0200
@@ -1,6 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
+
-- | Provides a high-level interface for processing YAML files.
--
-- This module reuses most of the infrastructure from the @aeson@ package.
@@ -16,6 +17,10 @@
--
-- For documentation on the @aeson@ types, functions, classes, and
-- operators, please see the @Data.Aeson@ module of the @aeson@ package.
+--
+-- Look in the examples directory of the source repository for some initial
+-- pointers on how to use this library.
+
#if (defined (ghcjs_HOST_OS))
module Data.Yaml {-# WARNING "GHCJS is not supported yet (will break at runtime once called)." #-}
#else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/README.md new/yaml-0.8.17.1/README.md
--- old/yaml-0.8.16/README.md 2016-02-15 10:17:58.000000000 +0100
+++ new/yaml-0.8.17.1/README.md 2016-04-14 17:22:07.000000000 +0200
@@ -2,18 +2,16 @@
Provides support for parsing and emitting Yaml documents.
-This package includes the [full libyaml C library version 0.1.5 by Kirill
-Simonov](http://pyyaml.org/wiki/LibYAML) in the package so you
-don't need to worry about any non-Haskell dependencies.
-
-The package is broken down into two primary modules.
-"Data.Yaml" provides a high-level interface based
-around the JSON datatypes provided by the @aeson@
-package. "Text.Libyaml" provides a lower-level,
-streaming interface. For most users, "Data.Yaml" is recommended.
-
-Additional modules:
-
-* Data.Yaml.Include supports adding `!include` directives to your YAML files.
-* DAta.Yaml.Builder and Data.Yaml.Parser allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
-* Data.Yaml.Aeson is currently a re-export of Data.Yaml to explicitly choose to use the aeson-compatible API.
+This package includes the [full libyaml C library version 0.1.5 by Kirill Simonov](http://pyyaml.org/wiki/LibYAML) in the package so you don't need to worry about any non-Haskell dependencies.
+
+The package is broken down into two primary modules. `Data.Yaml` provides a high-level interface based around the JSON datatypes provided by the `aeson` package. `Text.Libyaml` provides a lower-level, streaming interface. For most users, `Data.Yaml` is recommended.
+
+### Examples
+
+Usage examples can be found in the `Data.Yaml` documentation or in the [examples](./examples) directory.
+
+### Additional modules
+
+* `Data.Yaml.Include` supports adding `!include` directives to your YAML files.
+* `Data.Yaml.Builder` and `Data.Yaml.Parser` allow more fine-grained control of parsing an rendering, as opposed to just using the aeson typeclass and datatype system for parsing and rendering.
+* `Data.Yaml.Aeson` is currently a re-export of `Data.Yaml` to explicitly choose to use the aeson-compatible API.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/examples/Config.hs new/yaml-0.8.17.1/examples/Config.hs
--- old/yaml-0.8.16/examples/Config.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/yaml-0.8.17.1/examples/Config.hs 2016-04-14 17:22:07.000000000 +0200
@@ -0,0 +1,53 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes #-}
+
+module Config where
+
+import Data.Text (Text)
+import qualified Data.Yaml as Y
+import Data.Yaml (FromJSON(..), (.:))
+import Text.RawString.QQ
+import Data.ByteString (ByteString)
+import Control.Applicative
+
+configYaml :: ByteString
+configYaml = [r|
+resolver: lts-3.7
+packages:
+ - ./yesod-core
+ - ./yesod-static
+ - ./yesod-persistent
+ - ./yesod-newsfeed
+ - ./yesod-form
+ - ./yesod-auth
+ - ./yesod-auth-oauth
+ - ./yesod-sitemap
+ - ./yesod-test
+ - ./yesod-bin
+ - ./yesod
+ - ./yesod-eventsource
+ - ./yesod-websockets
+
+# Needed for LTS 2
+extra-deps:
+- wai-app-static-3.1.4.1
+|]
+
+data Config =
+ Config {
+ resolver :: Text
+ , packages :: [FilePath]
+ , extraDeps :: [Text]
+ } deriving (Eq, Show)
+
+instance FromJSON Config where
+ parseJSON (Y.Object v) =
+ Config <$>
+ v .: "resolver" <*>
+ v .: "packages" <*>
+ v .: "extra-deps"
+ parseJSON _ = fail "Expected Object for Config value"
+
+main :: IO ()
+main =
+ print $ (Y.decode configYaml :: Maybe Config)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/examples/Main.hs new/yaml-0.8.17.1/examples/Main.hs
--- old/yaml-0.8.16/examples/Main.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/yaml-0.8.17.1/examples/Main.hs 2016-04-14 17:22:07.000000000 +0200
@@ -0,0 +1,10 @@
+module Main where
+
+import qualified Config
+import qualified Simple
+
+main :: IO ()
+main = do
+ Simple.main
+ Config.main
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/examples/Simple.hs new/yaml-0.8.17.1/examples/Simple.hs
--- old/yaml-0.8.16/examples/Simple.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/yaml-0.8.17.1/examples/Simple.hs 2016-04-14 17:22:07.000000000 +0200
@@ -0,0 +1,13 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Simple where
+
+import qualified Data.Yaml as Y
+
+main :: IO ()
+main = do
+ print $ (Y.decode "[1,2,3]" :: Maybe [Integer])
+
+-- You can go one step further and decode into a custom type by implementing
+-- 'FromJSON' for that type. This is also appropriate where extra
+-- normalization, formatting or manipulation of the YAML is required on decode.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yaml-0.8.16/yaml.cabal new/yaml-0.8.17.1/yaml.cabal
--- old/yaml-0.8.16/yaml.cabal 2016-02-15 10:17:58.000000000 +0100
+++ new/yaml-0.8.17.1/yaml.cabal 2016-04-14 17:22:07.000000000 +0200
@@ -1,5 +1,5 @@
name: yaml
-version: 0.8.16
+version: 0.8.17.1
license: BSD3
license-file: LICENSE
author: Michael Snoyman