-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build failure: conduit 1.3.0 deprecated addCleanup
#14
Comments
addCleanup
Hi, thanks for reporting this. I haven't had a chance to upgrade to conduit 1.3 yet so I didn't notice. Is there any way to achieve similar functionality (ie: have OGR transactions rolled back automatically in case of exception inside the GDAL scope) with the new conduit? Otherwise I guess the API will have to break since I can't think of other way of implementing it except by making it continuation-based (like bracket) |
@albertov actually I'm not used to |
@albertov how can I test the correct behavior of the patch I'm working on? Actually, if I just totally remove the From the current implementation, I understood this behavior:
I'll be tempted to apply this patch: diff --git a/src/GDAL/Internal/Layer.chs b/src/GDAL/Internal/Layer.chs
index e435b47..944f0c5 100644
--- a/src/GDAL/Internal/Layer.chs
+++ b/src/GDAL/Internal/Layer.chs
@@ -78,14 +78,14 @@ module GDAL.Internal.Layer (
import Data.ByteString.Unsafe (unsafeUseAsCString)
import Data.Coerce (coerce)
import Data.Conduit ( Conduit, Sink, Source
- , addCleanup, awaitForever, yield
+ , awaitForever, yield
, bracketP, catchC
, (=$=))
import qualified Data.Conduit.List as CL
import Data.Text (Text)
import Control.Applicative (Applicative, (<$>), (<*>), pure)
-import Control.Exception (SomeException)
+import Control.Exception (SomeException(..))
import Control.Monad (liftM, when, void, (>=>), (<=<))
import Control.Monad.Base (MonadBase)
import Control.Monad.Catch (
@@ -377,9 +377,12 @@ instance HasLayerTransaction ReadWrite where
bracketP (alloc' state) free $ \ seed@(layer,_) -> do
liftIO $ checkOGRError "StartTransaction" $
{#call OGR_L_StartTransaction as ^#} (unLayer layer)
- addCleanup (\terminated -> when terminated (commit layer)) $
+
+ res <-
inside seed `catchC`
\(e :: SomeException) -> rollback layer >> throwM e
+ commit layer
+ pure res
where
alloc' = runWithInternalState alloc
free = closeLayer . fst
The only semantic possible difference I see with the previous implementation with Does it exists another source of "early" termination? Note that with some others mechanical changes, I'm able to run |
Hi @guibou . Sorry for the extremely late reply. I've missed your post until now. It's very possible that there's no test for this behavior so that would explain why removing |
@albertov the I'll push the conduit upgrade soon. Do you care about backward compatibility with previous conduit version or not? |
@guibou thanks! I don't personally care since I pin the version with nix. If it's compatible with both then great, else no big problem. |
Actually I was asking the question because I need to update the nix file too ;) Do you care about ghc 8.0 support or can I just tell the nix file to use whatever ghc is currently the default in nix? |
Better use the default one so it can fetch pre-compiled packages from cache.nixos.org, else there's a high chance it'll timeout in travis. 8.0 is outside the 2 year support period so we can ignore it at this point |
Conduit
addCleanup
function was removed inconduit-1.3.0
, as discussed here:However bindings-gdal still use them in
GDAL/Internal/Layer.chs
https://github.com/albertov/bindings-gdal/blob/master/src/GDAL/Internal/Layer.chs#L380The text was updated successfully, but these errors were encountered: