From 2c6905b45fc9c59bd4c39d92f7defb47dff13e3b Mon Sep 17 00:00:00 2001 From: "Scott R. Parish" Date: Mon, 18 Jan 2010 18:32:44 -0600 Subject: [PATCH] BSON.empty --- Database/MongoDB/BSON.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Database/MongoDB/BSON.hs b/Database/MongoDB/BSON.hs index ed51d13..d7907d5 100644 --- a/Database/MongoDB/BSON.hs +++ b/Database/MongoDB/BSON.hs @@ -31,7 +31,7 @@ module Database.MongoDB.BSON toBsonDoc, BinarySubType(..), -- * BsonDoc Operations - lookup, + empty, lookup, -- * Conversion fromBson, toBson ) @@ -43,7 +43,7 @@ import Data.Binary import Data.Binary.Get import Data.Binary.IEEE754 import Data.Binary.Put -import Data.ByteString.Char8 as C8 +import Data.ByteString.Char8 as C8 hiding (empty) import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy.UTF8 as L8 import qualified Data.ByteString.UTF8 as S8 @@ -96,6 +96,10 @@ class BsonDocOps a where -- | Return the BsonValue for given key, if any. lookup :: a -> BsonDoc -> Maybe BsonValue +-- | An empty BsonDoc +empty :: BsonDoc +empty = BsonDoc Map.empty + instance BsonDocOps L8.ByteString where toBsonDoc = BsonDoc . Map.fromList fromBsonDoc = bdFromBsonDoc