BSON.empty

This commit is contained in:
Scott R. Parish 2010-01-18 18:32:44 -06:00
parent 30925bc90f
commit 2c6905b45f

View file

@ -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