From 5addbf8465eb7816b348c548ff349c1511a59cd3 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 24 Sep 2009 01:28:38 +0300 Subject: [PATCH] Scalar changes in data-object --- Data/Object/Instances.hs | 9 ++++----- Web/Restful/Response.hs | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Data/Object/Instances.hs b/Data/Object/Instances.hs index 3bb2f241..3f6d21f5 100644 --- a/Data/Object/Instances.hs +++ b/Data/Object/Instances.hs @@ -21,7 +21,6 @@ module Data.Object.Instances import Data.Object import qualified Data.ByteString.Lazy as B -import qualified Data.ByteString as BS import Data.ByteString.Class import Web.Encodings (encodeJson) import Text.Yaml (encode) @@ -35,7 +34,7 @@ instance SafeFromObject Json where helper :: Object -> B.ByteString helper (Scalar s) = B.concat [ toLazyByteString "\"" - , encodeJson $ fromStrictByteString s + , encodeJson $ fromLazyByteString s , toLazyByteString "\"" ] helper (Sequence s) = B.concat @@ -48,10 +47,10 @@ instance SafeFromObject Json where , B.intercalate (toLazyByteString ",") $ map helper2 m , toLazyByteString "}" ] - helper2 :: (BS.ByteString, Object) -> B.ByteString + helper2 :: (B.ByteString, Object) -> B.ByteString helper2 (k, v) = B.concat [ toLazyByteString "\"" - , encodeJson $ fromStrictByteString k + , encodeJson $ fromLazyByteString k , toLazyByteString "\":" , helper v ] @@ -89,7 +88,7 @@ instance SafeFromObject Html where toLazyByteString "
" : map helper2 m ++ [ toLazyByteString "
" ] - helper2 :: (BS.ByteString, Object) -> B.ByteString + helper2 :: (B.ByteString, Object) -> B.ByteString helper2 (k, v) = B.concat $ [ toLazyByteString "
" , toLazyByteString k diff --git a/Web/Restful/Response.hs b/Web/Restful/Response.hs index c5db6c1d..fc0fd5ce 100644 --- a/Web/Restful/Response.hs +++ b/Web/Restful/Response.hs @@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeSynonymInstances #-} --------------------------------------------------------- -- -- Module : Web.Restful.Response