bson 0.3.2.3 → 0.3.2.6
raw patch · 4 files changed
+22/−7 lines, 4 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Bson: instance Data.Bson.Val Data.Time.Clock.POSIX.POSIXTime
- Data.Bson: instance Data.Bson.Val Data.Time.Clock.UTC.UTCTime
+ Data.Bson: instance Data.Bson.Val Data.Time.Clock.Internal.POSIXTime.POSIXTime
+ Data.Bson: instance Data.Bson.Val Data.Time.Clock.Internal.UTCTime.UTCTime
- Data.Bson: Oid :: Word32 -> Word64 -> ObjectId
+ Data.Bson: Oid :: {-# UNPACK #-} !Word32 -> {-# UNPACK #-} !Word64 -> ObjectId
- Data.Bson: class (Typeable a, Show a, Eq a) => Val a where valList = Array . map val valMaybe = maybe Null val cast'List (Array x) = mapM cast x cast'List _ = Nothing cast'Maybe Null = Just Nothing cast'Maybe v = fmap Just (cast' v)
+ Data.Bson: class (Typeable a, Show a, Eq a) => Val a
Files
- CHANGELOG.md +5/−0
- Data/Bson.hs +7/−1
- Data/Bson/Binary.hs +4/−2
- bson.cabal +6/−4
CHANGELOG.md view
@@ -1,6 +1,11 @@ # Change Log All notable changes to this project will be documented in this file. This project adheres to [Package Versioning Policy](https://wiki.haskell.org/Package_versioning_policy).+## [0.3.2.6] - 2018-05-14++### Added+- Simple deprecated types: 0x0C and 0x06+ ## [0.3.2] - 2015-10-28 ### Added
Data/Bson.hs view
@@ -4,6 +4,7 @@ -- Use the GHC language extension /OverloadedStrings/ to automatically convert -- String literals to Text +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE RankNTypes #-}@@ -60,8 +61,13 @@ -- ^ Get the current process id. getProcessID = c_getpid +#if defined(mingw32_HOST_OS) || defined(__MINGW32__)+foreign import ccall unsafe "_getpid"+ c_getpid :: IO Int+#else foreign import ccall unsafe "getpid" c_getpid :: IO Int+#endif roundTo :: (RealFrac a) => a -> a -> a -- ^ Round second number to nearest multiple of first number. Eg: roundTo (1/1000) 0.12345 = 0.123@@ -424,7 +430,7 @@ -- ** ObjectId -data ObjectId = Oid Word32 Word64 deriving (Typeable, Eq, Ord)+data ObjectId = Oid {-# UNPACK #-} !Word32 {-# UNPACK #-} !Word64 deriving (Typeable, Eq, Ord) -- ^ A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order. instance Show ObjectId where
Data/Bson/Binary.hs view
@@ -94,17 +94,19 @@ 0x05 -> return $ Md5 (MD5 b) 0x80 -> return $ UserDef (UserDefined b) _ -> fail $ "unknown Bson binary subtype " ++ show s+ 0x06 -> return Null 0x07 -> ObjId <$> getObjectId 0x08 -> Bool <$> getBool 0x09 -> UTC <$> getUTC 0x0A -> return Null 0x0B -> RegEx <$> getRegex+ 0x0C -> ObjId <$> getObjectId <* getString 0x0D -> JavaScr . Javascript [] <$> getString- 0x0F -> JavaScr . uncurry (flip Javascript) <$> getClosure 0x0E -> Sym <$> getSymbol+ 0x0F -> JavaScr . uncurry (flip Javascript) <$> getClosure 0x10 -> Int32 <$> getInt32- 0x12 -> Int64 <$> getInt64 0x11 -> Stamp <$> getMongoStamp+ 0x12 -> Int64 <$> getInt64 0xFF -> return (MinMax MinKey) 0x7F -> return (MinMax MaxKey) _ -> fail $ "unknown Bson value type " ++ show t
bson.cabal view
@@ -1,5 +1,5 @@ Name: bson-Version: 0.3.2.3+Version: 0.3.2.6 Synopsis: BSON documents are JSON-like objects with a standard binary encoding. Description: A BSON Document is an untyped (dynamically type-checked) record.@@ -9,7 +9,7 @@ and special types (Binary, Javascript, ObjectId, RegEx, and a few others). - A BSON Document is serialized to a standard binary encoding+ A BSON Document is serialized to a standard binary encoding defined at <http://bsonspec.org>. This implements version 1 of that spec. Category: Data@@ -17,7 +17,7 @@ Author: Tony Hannan Maintainer: Fedor Gogolev <knsd@knsd.net>, Greg Weber <greg@gregweber.info> Copyright: Copyright (c) 2010-2012 10gen Inc.-License: OtherLicense+License: Apache-2.0 License-file: LICENSE Cabal-version: >= 1.10 Build-type: Simple@@ -40,7 +40,9 @@ Exposed-modules: Data.Bson, Data.Bson.Binary - GHC-prof-options: -auto-all+Source-repository head+ Type: git+ Location: https://github.com/mongodb-haskell/bson Test-suite bson-tests Type: exitcode-stdio-1.0