hasbolt 0.1.6.1 → 0.1.6.2
raw patch · 3 files changed
+136/−117 lines, 3 filesdep ~binarydep ~bytestringdep ~containersnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: binary, bytestring, containers, criterion, data-default, hspec, mtl, text
API changes (from Hackage documentation)
- Database.Bolt: toValue :: IsValue a => a -> Value
+ Database.Bolt: toValue :: (IsValue a, HasCallStack) => a -> Value
- Database.Bolt: toValueList :: IsValue a => [a] -> Value
+ Database.Bolt: toValueList :: (IsValue a, HasCallStack) => [a] -> Value
- Database.Bolt.Lazy: toValue :: IsValue a => a -> Value
+ Database.Bolt.Lazy: toValue :: (IsValue a, HasCallStack) => a -> Value
- Database.Bolt.Lazy: toValueList :: IsValue a => [a] -> Value
+ Database.Bolt.Lazy: toValueList :: (IsValue a, HasCallStack) => [a] -> Value
Files
- hasbolt.cabal +108/−95
- src/Database/Bolt/Value/Instances.hs +5/−6
- src/Database/Bolt/Value/Type.hs +23/−16
hasbolt.cabal view
@@ -1,112 +1,125 @@-cabal-version: >=1.10-name: hasbolt-version: 0.1.6.1-license: BSD3-license-file: LICENSE-copyright: (c) 2018 Pavel Yakovlev-maintainer: pavel@yakovlev.me-author: Pavel Yakovlev, Martin Heuschober-homepage: https://github.com/zmactep/hasbolt#readme-synopsis: Haskell driver for Neo4j 3+ (BOLT protocol)+name: hasbolt+version: 0.1.6.2+synopsis: Haskell driver for Neo4j 3+ (BOLT protocol) description:- Haskell driver for Neo4j 3+ (BOLT protocol).- .- The package covers:- .+ Haskell driver for Neo4j 3+ (BOLT protocol).+ .+ The package covers:+ . -Data serialization and deserialization- .+ . -Nodes, relationships and paths support- .+ . -Cypher queries and responses- .+ . -Transactions and error handling- .+ . -Authentification- .+ . -TLS/SSL connection- .+ . -Bolt protocol version 3 initial support- .- The code was tested with neo4j versions 3.0 — 3.5 and GrapheneDB service+ .+ The code was tested with neo4j versions 3.0 — 3.5 and GrapheneDB service -category: Database-build-type: Simple -source-repository head- type: git- location: https://github.com/zmactep/hasbolt--library- exposed-modules:- Database.Bolt- Database.Bolt.Lazy- Database.Bolt.Lens- Database.Bolt.Serialization-- hs-source-dirs: src- other-modules:- Database.Bolt.Value.Type- Database.Bolt.Value.Helpers- Database.Bolt.Value.Instances- Database.Bolt.Connection.Connection- Database.Bolt.Connection.Type- Database.Bolt.Connection.Instances- Database.Bolt.Connection.Pipe- Database.Bolt.Connection- Database.Bolt.Record- Database.Bolt.Transaction+homepage: https://github.com/zmactep/hasbolt#readme+license: BSD3+license-file: LICENSE+author: Pavel Yakovlev, Martin Heuschober+maintainer: pavel@yakovlev.me+copyright: (c) 2018 Pavel Yakovlev+category: Database+build-type: Simple+-- extra-source-files:+cabal-version: >=1.10 - default-language: Haskell2010- ghc-options: -Wall- build-depends:- base >=4.7 && <5,- bytestring >=0.10.8.1 && <0.12,- text >=1.2.2.1 && <1.3,- containers >=0.5.7.1 && <0.7,- binary >=0.8.3.0 && <1.0,- data-binary-ieee754 >=0.4.4 && <0.5,- mtl >=2.2.0 && <2.3,- network >=2.6.3.1 && <3.2,- connection >=0.2.8 && <0.4,- data-default >=0.7.1.1 && <0.8,- deepseq ==1.4.*,- deepseq-generics >=0.2.0.0 && <0.3+tested-with:+ GHC ==8.6.5+ || ==8.8.4+ || ==8.10.7+ || ==9.0.2+ || ==9.2.2 - if impl(ghc <8.6)- build-depends: contravariant >=1.4.1 && <1.6+library+ hs-source-dirs: src+ exposed-modules: Database.Bolt+ , Database.Bolt.Lazy+ , Database.Bolt.Lens+ , Database.Bolt.Serialization+ other-modules: Database.Bolt.Value.Type+ , Database.Bolt.Value.Helpers+ , Database.Bolt.Value.Instances+ , Database.Bolt.Connection.Connection+ , Database.Bolt.Connection.Type+ , Database.Bolt.Connection.Instances+ , Database.Bolt.Connection.Pipe+ , Database.Bolt.Connection+ , Database.Bolt.Record+ , Database.Bolt.Transaction+ build-depends: base >= 4.7 && < 5+ , bytestring >= 0.10.8.1 && < 0.12+ , text >= 1.2.2.1 && < 1.3+ , containers >= 0.5.7.1 && < 0.7+ , binary >= 0.8.3.0 && < 1.0+ , data-binary-ieee754 >= 0.4.4 && < 0.5+ , mtl >= 2.2.0 && < 2.3+ , network >= 2.6.3.1 && < 3.2+ , connection >= 0.2.8 && < 0.4+ , data-default >= 0.7.1.1 && < 0.8+ , deepseq >= 1.4 && < 1.5+ , deepseq-generics >= 0.2.0.0 && < 0.3+ if impl(ghc < 8.6)+ build-depends: contravariant >= 1.4.1 && < 1.6+ if impl(ghc < 8.0)+ build-depends: fail >= 4.9 && < 5+ default-language: Haskell2010+ ghc-options: -Wall - if impl(ghc <8.0)- build-depends: fail >=4.9 && <5+-- test-suite transaction+-- type: exitcode-stdio-1.0+-- hs-source-dirs: test+-- main-is: TransactionSpec.hs+-- build-depends: base >= 4.8 && < 5+-- , hasbolt+-- , hspec >= 2.4.1 && < 2.9+-- , QuickCheck >= 2.9 && < 2.14+-- , data-default+-- , text+-- ghc-options: -threaded -rtsopts -with-rtsopts=-N+-- default-language: Haskell2010 test-suite hasbolt-test- type: exitcode-stdio-1.0- main-is: Spec.hs- hs-source-dirs: test- other-modules: Hex- default-language: Haskell2010- ghc-options: -threaded -rtsopts -with-rtsopts=-N- build-depends:- base >=4.7 && <5,- hasbolt -any,- hspec >=2.4.1 && <2.9,- QuickCheck >=2.9 && <2.15,- text >=1.2.4.1 && <1.3,- containers >=0.6.2.1 && <0.7,- binary >=0.8.8.0 && <0.9,- bytestring >=0.10.12.0 && <0.11+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Spec.hs+ other-modules: Hex+ build-depends: base >= 4.7 && < 5+ , hasbolt+ , hspec >= 2.4.1 && < 2.9+ , QuickCheck >= 2.9 && < 2.15+ , text+ , containers+ , binary+ , bytestring+ ghc-options: -threaded -rtsopts -with-rtsopts=-N+ default-language: Haskell2010 benchmark hasbolt-bench- type: exitcode-stdio-1.0- main-is: Main.hs- hs-source-dirs: bench- default-language: Haskell2010- ghc-options: -threaded -rtsopts -eventlog- build-depends:- base >=4.7 && <5,- base64-bytestring >=1.1 && <1.3,- binary >=0.8.8.0 && <0.9,- bytestring >=0.10.12.0 && <0.11,- criterion >=1.5.9.0 && <1.6,- data-default >=0.7.1.1 && <0.8,- hasbolt -any,- hspec >=2.4.1 && <2.9+ type: exitcode-stdio-1.0+ hs-source-dirs: bench+ main-is: Main.hs+ build-depends: base >= 4.7 && < 5+ , base64-bytestring >= 1.1 && < 1.3+ , binary+ , bytestring+ , criterion+ , data-default+ , hasbolt+ , hspec >= 2.4.1 && < 2.9+ ghc-options: -threaded -rtsopts -eventlog+ default-language: Haskell2010++source-repository head+ type: git+ location: https://github.com/zmactep/hasbolt
src/Database/Bolt/Value/Instances.hs view
@@ -9,7 +9,6 @@ import Database.Bolt.Value.Helpers import Database.Bolt.Value.Type -import Control.Applicative (pure) import Control.Monad (forM, replicateM) import Control.Monad.Except (MonadError (..)) import Data.Binary (Binary (..), Put, decode, encode)@@ -48,7 +47,7 @@ | isIntX 8 int = putWord8 int8Code >> putWord8 (fromIntegral int) | isIntX 16 int = putWord8 int16Code >> putWord16be (fromIntegral int :: Word16) | isIntX 32 int = putWord8 int32Code >> putWord32be (fromIntegral int :: Word32)- | isIntX 62 int = putWord8 int64Code >> putWord64be (fromIntegral int :: Word64)+ | isIntX 64 int = putWord8 int64Code >> putWord64be (fromIntegral int :: Word64) | otherwise = error "Cannot pack so large integer" unpackT = getWord8 >>= unpackByMarker@@ -204,7 +203,7 @@ | otherwise = error "Cannot pack so large collection" size4,size8, size16,size32 :: Integral a => a-size4 = 2^(4 :: Int)-size8 = 2^(8 :: Int)-size16 = 2^(16 :: Int)-size32 = 2^(32 :: Int)+size4 = 2^(4 :: Int)+size8 = 2^(8 :: Int)+size16 = 2^(16 :: Int)+size32 = 2^(32 :: Int)
src/Database/Bolt/Value/Type.hs view
@@ -8,21 +8,22 @@ {-# LANGUAGE DerivingStrategies #-} module Database.Bolt.Value.Type where -import Control.DeepSeq (NFData)-import Control.Monad.Except (ExceptT, MonadError (..))-import Control.Monad.Fail as Fail (MonadFail (..))-import Control.Monad.State (MonadState (..), StateT (..))+import Control.DeepSeq (NFData)+import Control.Monad.Except (ExceptT, MonadError (..))+import Control.Monad.Fail as Fail (MonadFail (..))+import Control.Monad.State (MonadState (..), StateT (..)) import Data.Binary.Get import Data.Binary.Put-import Data.ByteString (ByteString)-import Data.ByteString.Lazy (fromStrict)-import qualified Data.ByteString.Lazy as BSL-import Data.Map.Strict (Map, fromList)-import Data.Monoid ((<>))-import Data.Text (Text)-import qualified Data.Text as T (pack, unpack)-import Data.Word (Word8)-import GHC.Generics (Generic)+import Data.ByteString (ByteString)+import Data.ByteString.Lazy (fromStrict)+import qualified Data.ByteString.Lazy as BSL+import Data.List.NonEmpty (NonEmpty (..), toList)+import Data.Map.Strict (Map, fromList)+import Data.Text (Text)+import qualified Data.Text as T (pack, unpack)+import Data.Word (Word8)+import GHC.Generics (Generic)+import GHC.Stack (HasCallStack) -- |Error during unpack process data UnpackError = NotNull@@ -109,9 +110,9 @@ -- |Every datatype that can be represented as BOLT protocol value class IsValue a where -- |Wraps value with 'Value' constructor- toValue :: a -> Value+ toValue :: HasCallStack => a -> Value -- |How to represent a list of values- toValueList :: [a] -> Value+ toValueList :: HasCallStack => [a] -> Value toValueList = L . fmap toValue instance IsValue () where@@ -142,6 +143,13 @@ instance IsValue a => IsValue [a] where toValue = toValueList +instance IsValue a => IsValue (NonEmpty a) where+ toValue = toValue . toList++instance IsValue a => IsValue (Maybe a) where+ toValue (Just a) = toValue a+ toValue _ = N ()+ instance IsValue (Map Text Value) where toValue = M @@ -182,4 +190,3 @@ , pathSequence :: [Int] -- ^Path sequence } deriving (Show, Eq)-