packages feed

json-builder 0.2.5 → 0.3

raw patch · 3 files changed

+16/−6 lines, 3 files

Files

json-builder.cabal view
@@ -1,5 +1,5 @@ Name:                json-builder-Version:             0.2.5+Version:             0.3 Synopsis:            Data structure agnostic JSON serialization License:             BSD3 License-file:        LICENSE@@ -47,4 +47,4 @@ source-repository this   type:     git   location: http://github.com/lpsmith/json-builder-  tag:      v0.2.5+  tag:      v0.3
src/Data/Json/Builder.hs view
@@ -17,6 +17,7 @@      , toJsonBS      , toJsonLBS      , Value(toJson)+     , jsNull        -- * Json Arrays @[\"foobar\",true,42]@      , Array      , element
src/Data/Json/Builder/Implementation.hs view
@@ -188,13 +188,15 @@ toJsonLBS :: Value a => a -> BL.ByteString toJsonLBS = toLazyByteString . toBuilder +-- A primitive to render  --- Primitive instances for json-builder+-- | this renders as Json's @null@ value. --- | renders as @null@-instance Value () where-  toJson _ = Json (copyByteString "null")+jsNull :: Json+jsNull = Json (copyByteString "null") +-- Primitive instances for json-builder+ instance Value Int     where   toJson = Json . integral @@ -330,6 +332,13 @@  instance (Value a, Value b) => JsArray (a,b) where   toArray (a,b) = element a ++ element b++-- | renders as an 'Array'+instance Value () where+  toJson = toJson . toArray++instance JsArray () where+  toArray _ = mempty  -- | renders as an 'Array' instance (Value a, Value b) => Value (a,b) where