bson-mapping 0.1.3 → 0.1.3.2
raw patch · 2 files changed
+14/−14 lines, 2 filesdep +textdep −compact-string-fixdep ~bson
Dependencies added: text
Dependencies removed: compact-string-fix
Dependency ranges changed: bson
Files
- bson-mapping.cabal +4/−4
- src/Data/Bson/Mapping.hs +10/−10
bson-mapping.cabal view
@@ -1,5 +1,5 @@ Name: bson-mapping-Version: 0.1.3+Version: 0.1.3.2 License: OtherLicense License-File: LICENSE Author: Francesco Mazzoli <f@mazzo.li>@@ -15,14 +15,14 @@ source-repository head type: git- location: git://github.com/rostayob/bson-mapping.git+ location: git://github.com/bitonic/bson-mapping.git Library Build-Depends: base >= 4 && < 5, template-haskell >= 2.5, th-lift >= 0.5.3,- bson >= 0.1.3,- compact-string-fix >= 0.3.1+ bson >= 0.2,+ text >= 1.1 hs-source-dirs: src
src/Data/Bson/Mapping.hs view
@@ -13,14 +13,14 @@ > import Data.Bson.Mapping > import Data.Time.Clock-> import Data.Data (Data, Typeable)+> import Data.Data (Typeable) > > data Post = Post { time :: UTCTime > , author :: String > , content :: String > , votes :: Int > }-> deriving (Show, Read, Eq, Ord, Data, Typeable)+> deriving (Show, Read, Eq, Ord, Typeable) > $(deriveBson ''Post) > > main :: IO ()@@ -46,13 +46,13 @@ import Prelude hiding (lookup) import Data.Bson-import Data.Data (Data, Typeable)-import Data.CompactString.UTF8 (append, cons)+import Data.Data (Typeable)+import Data.Text (append, cons) import Language.Haskell.TH import Language.Haskell.TH.Lift () -class (Show a, Eq a, Data a, Typeable a) => Bson a where+class (Show a, Eq a, Typeable a) => Bson a where toBson :: a -> Document fromBson :: Monad m => Document -> m a @@ -194,14 +194,14 @@ genStmts [] _ = return ([], []) genStmts (f : fs) doc = do fvar <- newName "f"- let stmt = bindS (varP fvar) $ [| lookup (u (nameBase f)) $doc |]+ let stmt = bindS (varP fvar) $ [| lookup (nameBase f) $doc |] (fields, stmts) <- genStmts fs doc return $ (return (f, VarE fvar) : fields, stmt : stmts) -dataField, consField :: UString-dataField = u "_data"-consField = u "_cons"+dataField, consField :: String+dataField = "_data"+consField = "_cons" {-| @@ -236,7 +236,7 @@ subDocument lab doc = [append lab (cons '.' l) := v | (l := v) <- doc] getLabel :: Name -> Q Exp-getLabel n = [| u (nameBase n) |]+getLabel n = [| (nameBase n) |] {-|