yesod-json 0.0.0.1 → 0.1.0
raw patch · 2 files changed
+18/−12 lines, 2 filesdep +aesondep +vectordep −json-enumeratordep −json-typesdep ~containersdep ~yesod-corePVP ok
version bump matches the API change (PVP)
Dependencies added: aeson, vector
Dependencies removed: json-enumerator, json-types
Dependency ranges changed: containers, yesod-core
API changes (from Hackage documentation)
Files
- Yesod/Json.hs +13/−7
- yesod-json.cabal +5/−5
Yesod/Json.hs view
@@ -18,14 +18,15 @@ ) import Yesod.Core (defaultLayout, Yesod) import Yesod.Widget (GWidget)-import qualified Data.JSON.Types as J-import qualified Text.JSON.Enumerator as J-import Data.Text.Lazy (pack)+import qualified Data.Aeson as J+import Data.Aeson.Encode (fromValue)+import Data.Text (pack) import Control.Arrow (first) import Data.Map (fromList)+import qualified Data.Vector as V instance ToContent J.Value where- toContent = flip ContentBuilder Nothing . J.renderValue+ toContent = flip ContentBuilder Nothing . fromValue -- | Provide both an HTML and JSON representation for a piece of data, using -- the default layout for the HTML output ('defaultLayout').@@ -44,10 +45,15 @@ type Json = J.Value jsonScalar :: String -> Json-jsonScalar = J.ValueAtom . J.AtomText . pack+jsonScalar = J.String . pack jsonList :: [Json] -> Json-jsonList = J.ValueArray+jsonList = J.Array . V.fromList jsonMap :: [(String, Json)] -> Json-jsonMap = J.ValueObject . fromList . map (first pack)+jsonMap = J.Object . fromList . map (first pack)++{- FIXME+instance ToJavascript J.Value where+ toJavascript = fromLazyText . decodeUtf8 . toLazyByteString . JE.renderValue+-}
yesod-json.cabal view
@@ -1,5 +1,5 @@ name: yesod-json-version: 0.0.0.1+version: 0.1.0 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -13,11 +13,11 @@ library build-depends: base >= 4 && < 5- , yesod-core >= 0.7 && < 0.8- , json-enumerator >= 0.0 && < 0.1- , json-types >= 0.1 && < 0.2- , containers >= 0.2 && < 0.5+ , yesod-core >= 0.8 && < 0.9+ , aeson >= 0.3.1.1 && < 0.4 , text >= 0.8 && < 0.12+ , vector+ , containers exposed-modules: Yesod.Json ghc-options: -Wall