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, toBsonDoc,
BinarySubType(..), BinarySubType(..),
-- * BsonDoc Operations -- * BsonDoc Operations
lookup, empty, lookup,
-- * Conversion -- * Conversion
fromBson, toBson fromBson, toBson
) )
@ -43,7 +43,7 @@ import Data.Binary
import Data.Binary.Get import Data.Binary.Get
import Data.Binary.IEEE754 import Data.Binary.IEEE754
import Data.Binary.Put 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 as L
import qualified Data.ByteString.Lazy.UTF8 as L8 import qualified Data.ByteString.Lazy.UTF8 as L8
import qualified Data.ByteString.UTF8 as S8 import qualified Data.ByteString.UTF8 as S8
@ -96,6 +96,10 @@ class BsonDocOps a where
-- | Return the BsonValue for given key, if any. -- | Return the BsonValue for given key, if any.
lookup :: a -> BsonDoc -> Maybe BsonValue lookup :: a -> BsonDoc -> Maybe BsonValue
-- | An empty BsonDoc
empty :: BsonDoc
empty = BsonDoc Map.empty
instance BsonDocOps L8.ByteString where instance BsonDocOps L8.ByteString where
toBsonDoc = BsonDoc . Map.fromList toBsonDoc = BsonDoc . Map.fromList
fromBsonDoc = bdFromBsonDoc fromBsonDoc = bdFromBsonDoc