Hello community,
here is the log from the commit of package ghc-yesod-core for openSUSE:Factory checked in at 2016-07-01 09:58:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-yesod-core (Old)
and /work/SRC/openSUSE:Factory/.ghc-yesod-core.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-yesod-core"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-yesod-core/ghc-yesod-core.changes 2016-05-03 09:36:58.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-yesod-core.new/ghc-yesod-core.changes 2016-07-01 09:58:53.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Jun 21 04:59:53 UTC 2016 - mimi.vx@gmail.com
+
+- update to 1.4.21
+* Add support for Encoding from aeson-0.11
+
+-------------------------------------------------------------------
Old:
----
yesod-core-1.4.20.2.tar.gz
New:
----
yesod-core-1.4.21.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-yesod-core.spec ++++++
--- /var/tmp/diff_new_pack.WIvPXN/_old 2016-07-01 09:58:54.000000000 +0200
+++ /var/tmp/diff_new_pack.WIvPXN/_new 2016-07-01 09:58:54.000000000 +0200
@@ -19,7 +19,7 @@
%global pkg_name yesod-core
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 1.4.20.2
+Version: 1.4.21
Release: 0
Summary: Creation of type-safe, RESTful web applications
License: MIT
++++++ yesod-core-1.4.20.2.tar.gz -> yesod-core-1.4.21.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/ChangeLog.md new/yesod-core-1.4.21/ChangeLog.md
--- old/yesod-core-1.4.20.2/ChangeLog.md 2016-04-25 15:57:33.000000000 +0200
+++ new/yesod-core-1.4.21/ChangeLog.md 2016-06-20 16:31:06.000000000 +0200
@@ -1,3 +1,7 @@
+## 1.4.21
+
+* Add support for `Encoding` from `aeson-0.11` [#1241](https://github.com/yesodweb/yesod/pull/1241)
+
## 1.4.20.2
* GHC 8 support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/Yesod/Core/Class/Yesod.hs new/yesod-core-1.4.21/Yesod/Core/Class/Yesod.hs
--- old/yesod-core-1.4.20.2/Yesod/Core/Class/Yesod.hs 2016-03-21 11:57:27.000000000 +0100
+++ new/yesod-core-1.4.21/Yesod/Core/Class/Yesod.hs 2016-06-20 16:31:06.000000000 +0200
@@ -226,11 +226,7 @@
messageLoggerSource site = defaultMessageLoggerSource $ shouldLogIO site
-- | Where to Load sripts from. We recommend the default value,
- -- 'BottomOfBody'. Alternatively use the built in async yepnope loader:
- --
- -- > BottomOfHeadAsync $ loadJsYepnope $ Right $ StaticR js_modernizr_js
- --
- -- Or write your own async js loader.
+ -- 'BottomOfBody'.
jsLoader :: site -> ScriptLoadPosition site
jsLoader _ = BottomOfBody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/Yesod/Core/Content.hs new/yesod-core-1.4.21/Yesod/Core/Content.hs
--- old/yesod-core-1.4.20.2/Yesod/Core/Content.hs 2015-11-24 03:34:45.000000000 +0100
+++ new/yesod-core-1.4.21/Yesod/Core/Content.hs 2016-06-20 16:31:06.000000000 +0200
@@ -251,9 +251,20 @@
#else
. fromValue
#endif
+
+#if MIN_VERSION_aeson(0, 11, 0)
+instance ToContent J.Encoding where
+ toContent = flip ContentBuilder Nothing . J.fromEncoding
+#endif
+
instance HasContentType J.Value where
getContentType _ = typeJson
+#if MIN_VERSION_aeson(0, 11, 0)
+instance HasContentType J.Encoding where
+ getContentType _ = typeJson
+#endif
+
instance HasContentType Html where
getContentType _ = typeHtml
@@ -289,6 +300,10 @@
toTypedContent (RepXml c) = TypedContent typeXml c
instance ToTypedContent J.Value where
toTypedContent v = TypedContent typeJson (toContent v)
+#if MIN_VERSION_aeson(0, 11, 0)
+instance ToTypedContent J.Encoding where
+ toTypedContent e = TypedContent typeJson (toContent e)
+#endif
instance ToTypedContent Html where
toTypedContent h = TypedContent typeHtml (toContent h)
instance ToTypedContent T.Text where
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/Yesod/Core/Json.hs new/yesod-core-1.4.21/Yesod/Core/Json.hs
--- old/yesod-core-1.4.20.2/Yesod/Core/Json.hs 2015-11-24 03:34:45.000000000 +0100
+++ new/yesod-core-1.4.21/Yesod/Core/Json.hs 2016-06-20 16:31:06.000000000 +0200
@@ -6,6 +6,9 @@
defaultLayoutJson
, jsonToRepJson
, returnJson
+#if MIN_VERSION_aeson(0, 11, 0)
+ , returnJsonEncoding
+#endif
, provideJson
-- * Convert to a JSON value
@@ -24,6 +27,9 @@
-- * Convenience functions
, jsonOrRedirect
+#if MIN_VERSION_aeson(0, 11, 0)
+ , jsonEncodingOrRedirect
+#endif
, acceptsJson
) where
@@ -52,35 +58,51 @@
-- data, using the default layout for the HTML output
-- ('defaultLayout').
--
--- /Since: 0.3.0/
+-- @since 0.3.0
defaultLayoutJson :: (Yesod site, J.ToJSON a)
=> WidgetT site IO () -- ^ HTML
-> HandlerT site IO a -- ^ JSON
-> HandlerT site IO TypedContent
defaultLayoutJson w json = selectRep $ do
provideRep $ defaultLayout w
+#if MIN_VERSION_aeson(0, 11, 0)
+ provideRep $ fmap J.toEncoding json
+#else
provideRep $ fmap J.toJSON json
+#endif
-- | Wraps a data type in a 'RepJson'. The data type must
-- support conversion to JSON via 'J.ToJSON'.
--
--- /Since: 0.3.0/
+-- @since 0.3.0
jsonToRepJson :: (Monad m, J.ToJSON a) => a -> m J.Value
jsonToRepJson = return . J.toJSON
{-# DEPRECATED jsonToRepJson "Use returnJson instead" #-}
-- | Convert a value to a JSON representation via aeson\'s 'J.toJSON' function.
--
--- Since 1.2.1
+-- @since 1.2.1
returnJson :: (Monad m, J.ToJSON a) => a -> m J.Value
returnJson = return . J.toJSON
+#if MIN_VERSION_aeson(0, 11, 0)
+-- | Convert a value to a JSON representation via aeson\'s 'J.toEncoding' function.
+--
+-- @since 1.4.21
+returnJsonEncoding :: (Monad m, J.ToJSON a) => a -> m J.Encoding
+returnJsonEncoding = return . J.toEncoding
+#endif
+
-- | Provide a JSON representation for usage with 'selectReps', using aeson\'s
--- 'J.toJSON' function to perform the conversion.
+-- 'J.toJSON' (aeson >= 0.11: 'J.toEncoding') function to perform the conversion.
--
--- Since 1.2.1
+-- @since 1.2.1
provideJson :: (Monad m, J.ToJSON a) => a -> Writer (Endo [ProvidedRep m]) ()
+#if MIN_VERSION_aeson(0, 11, 0)
+provideJson = provideRep . return . J.toEncoding
+#else
provideJson = provideRep . return . J.toJSON
+#endif
-- | Parse the request body to a data type as a JSON value. The
-- data type must support conversion from JSON via 'J.FromJSON'.
@@ -91,7 +113,7 @@
-- twice will result in a parse error on the second call, since the request
-- body will no longer be available.
--
--- /Since: 0.3.0/
+-- @since 0.3.0
parseJsonBody :: (MonadHandler m, J.FromJSON a) => m (J.Result a)
parseJsonBody = do
eValue <- rawRequestBody $$ runCatchC (sinkParser JP.value')
@@ -129,9 +151,32 @@
=> Route (HandlerSite m) -- ^ Redirect target
-> a -- ^ Data to send via JSON
-> m J.Value
-jsonOrRedirect r j = do
+jsonOrRedirect = jsonOrRedirect' J.toJSON
+
+#if MIN_VERSION_aeson(0, 11, 0)
+-- | jsonEncodingOrRedirect simplifies the scenario where a POST handler sends a different
+-- response based on Accept headers:
+--
+-- 1. 200 with JSON data if the client prefers
+-- @application\/json@ (e.g. AJAX, see 'acceptsJSON').
+--
+-- 2. 3xx otherwise, following the PRG pattern.
+-- @since 1.4.21
+jsonEncodingOrRedirect :: (MonadHandler m, J.ToJSON a)
+ => Route (HandlerSite m) -- ^ Redirect target
+ -> a -- ^ Data to send via JSON
+ -> m J.Encoding
+jsonEncodingOrRedirect = jsonOrRedirect' J.toEncoding
+#endif
+
+jsonOrRedirect' :: (MonadHandler m, J.ToJSON a)
+ => (a -> b)
+ -> Route (HandlerSite m) -- ^ Redirect target
+ -> a -- ^ Data to send via JSON
+ -> m b
+jsonOrRedirect' f r j = do
q <- acceptsJson
- if q then return (J.toJSON j)
+ if q then return (f j)
else redirect r
-- | Returns @True@ if the client prefers @application\/json@ as
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/Yesod/Routes/Parse.hs new/yesod-core-1.4.21/Yesod/Routes/Parse.hs
--- old/yesod-core-1.4.20.2/Yesod/Routes/Parse.hs 2016-03-13 07:25:43.000000000 +0100
+++ new/yesod-core-1.4.21/Yesod/Routes/Parse.hs 2016-06-20 16:31:06.000000000 +0200
@@ -58,7 +58,7 @@
{ quoteExp = lift . resourcesFromString
}
--- | Convert a multi-line string to a set of resources. See documentation for
+-- | Converts a multi-line string to a set of resources. See documentation for
-- the format of this string. This is a partial function which calls 'error' on
-- invalid input.
resourcesFromString :: String -> [ResourceTree String]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yesod-core-1.4.20.2/yesod-core.cabal new/yesod-core-1.4.21/yesod-core.cabal
--- old/yesod-core-1.4.20.2/yesod-core.cabal 2016-04-25 15:57:26.000000000 +0200
+++ new/yesod-core-1.4.21/yesod-core.cabal 2016-06-20 16:31:06.000000000 +0200
@@ -1,5 +1,5 @@
name: yesod-core
-version: 1.4.20.2
+version: 1.4.21
license: MIT
license-file: LICENSE
author: Michael Snoyman