From 1002b7a6c29005619b0e53bca9a297e6a50c2967 Mon Sep 17 00:00:00 2001 From: Maxim Koltsov Date: Tue, 17 Dec 2019 11:31:32 +0300 Subject: [PATCH] Update to hasbolt-0.1.4.0 (#35) --- CHANGELOG.md | 6 ++++++ hasbolt-extras.cabal | 4 ++-- src/Database/Bolt/Extras/Graph/Internal/Put.hs | 9 ++++----- src/Database/Bolt/Extras/Utils.hs | 12 +++++++++--- stack.yaml | 2 +- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 334b62b..0c0409c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.0.1.0] - 2019-12-17 +### Changed +- Use `hasbolt` 0.1.4.0. +### Added +- Compatibility function `exact` from older `hasbolt`. + ## [0.0.0.25] - 2019-12-07 ### Added - `makeNodeLikeWith` and `makeURelationLikeWith` functions. diff --git a/hasbolt-extras.cabal b/hasbolt-extras.cabal index fde21da..0d5b78a 100644 --- a/hasbolt-extras.cabal +++ b/hasbolt-extras.cabal @@ -1,5 +1,5 @@ name: hasbolt-extras -version: 0.0.0.25 +version: 0.0.1.0 synopsis: Extras for hasbolt library description: Extras for hasbolt library homepage: https://github.com/biocad/hasbolt-extras#readme @@ -56,7 +56,7 @@ library , aeson-casing >= 0.1.0.5 , containers >= 0.5.10.2 , free >= 5.0 - , hasbolt >= 0.1.3.5 + , hasbolt >= 0.1.4.0 , lens >= 4.16 , mtl >= 2.2.0 , neat-interpolation >= 0.3.2.0 diff --git a/src/Database/Bolt/Extras/Graph/Internal/Put.hs b/src/Database/Bolt/Extras/Graph/Internal/Put.hs index bd7dae0..342d821 100644 --- a/src/Database/Bolt/Extras/Graph/Internal/Put.hs +++ b/src/Database/Bolt/Extras/Graph/Internal/Put.hs @@ -2,7 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} +{-# OPTIONS_GHC -fno-warn-orphans -Wno-deprecations #-} module Database.Bolt.Extras.Graph.Internal.Put ( @@ -19,10 +19,8 @@ import Data.Monoid ((<>)) import Data.Text (Text, intercalate, pack) -import Database.Bolt (Node (..), RecordValue (..), - URelationship (..), - Value (..), - exact) +import Database.Bolt (Node (..), URelationship (..), + Value (..)) import Database.Bolt.Extras (BoltId, ToCypher (..), fromInt) import Database.Bolt.Extras.Graph.Internal.AbstractGraph (Graph (..), @@ -31,6 +29,7 @@ import Database.Bolt.Extras.Graph.Internal.AbstractGraph (Graph (..), import Database.Bolt.Extras.Graph.Internal.Class (Extractable (..), Requestable (..), Returnable (..)) +import Database.Bolt.Extras.Utils (exact) import NeatInterpolation (text) ------------------------------------------------------------------------------------------------ diff --git a/src/Database/Bolt/Extras/Utils.hs b/src/Database/Bolt/Extras/Utils.hs index de28c81..8ef0bcb 100644 --- a/src/Database/Bolt/Extras/Utils.hs +++ b/src/Database/Bolt/Extras/Utils.hs @@ -7,15 +7,16 @@ module Database.Bolt.Extras.Utils , currentLoc , exactValues , exactValuesM + , exact ) where -import Control.Monad.IO.Class (MonadIO) +import Control.Monad.IO.Class (MonadIO (..)) import Data.List (nub) import Data.Map.Strict as M ((!), (!?)) import qualified Data.Map.Strict as M (union) import Data.Text (Text) import Database.Bolt as B (BoltActionT, Node (..), Record, - RecordValue, Value (..), exact) + RecordValue (..), Value (..)) import Language.Haskell.TH (Exp (..), Lit (..), Loc (..), Q, location) import Text.Printf (printf) @@ -42,9 +43,14 @@ currentLoc = do loc <- location pure $ LitE $ StringL $ printf "%s:%d: " (loc_module loc) (fst $ loc_start loc) +-- | Unpack a value, using 'fail' in 'IO` to report errors. +{-# DEPRECATED exact "This function exists for compatibility, consider using pure exactEither or exactMaybe instead." #-} +exact :: (MonadIO m, RecordValue a) => Value -> m a +exact = either (liftIO . fail . show) pure . exactEither + -- | Extract values -- -exactValues :: (Monad m, RecordValue a) => Text -> [Record] -> m [a] +exactValues :: (MonadIO m, RecordValue a) => Text -> [Record] -> m [a] exactValues var = mapM (exact . (! var)) -- | Extract values (maybe) diff --git a/stack.yaml b/stack.yaml index af71e52..dc27c0b 100644 --- a/stack.yaml +++ b/stack.yaml @@ -4,7 +4,7 @@ packages: - '.' extra-deps: - - hasbolt-0.1.3.5 + - hasbolt-0.1.4.0 # https://github.com/commercialhaskell/stack/issues/3520 ignore-revision-mismatch: true