diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 75478174..74109fb1 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -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 --git a/yesod-core/Yesod/Core/Json.hs b/yesod-core/Yesod/Core/Json.hs index d112c3d4..58c101a0 100644 --- a/yesod-core/Yesod/Core/Json.hs +++ b/yesod-core/Yesod/Core/Json.hs @@ -58,7 +58,7 @@ import Control.Monad (liftM) -- 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 @@ -74,21 +74,21 @@ defaultLayoutJson w json = selectRep $ do -- | 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 ? +-- @since 1.4.21 returnJsonEncoding :: (Monad m, J.ToJSON a) => a -> m J.Encoding returnJsonEncoding = return . J.toEncoding #endif @@ -96,7 +96,7 @@ returnJsonEncoding = return . J.toEncoding -- | Provide a JSON representation for usage with 'selectReps', using aeson\'s -- '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 @@ -113,7 +113,7 @@ provideJson = provideRep . return . J.toJSON -- 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') @@ -161,7 +161,7 @@ jsonOrRedirect = jsonOrRedirect' J.toJSON -- @application\/json@ (e.g. AJAX, see 'acceptsJSON'). -- -- 2. 3xx otherwise, following the PRG pattern. --- Since ? +-- @since 1.4.21 jsonEncodingOrRedirect :: (MonadHandler m, J.ToJSON a) => Route (HandlerSite m) -- ^ Redirect target -> a -- ^ Data to send via JSON diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 4357e38d..33c5fb9b 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.4.20.2 +version: 1.4.21 license: MIT license-file: LICENSE author: Michael Snoyman