diff --git a/demos/demo-webdriver-pool/app/Main.hs b/demos/demo-webdriver-pool/app/Main.hs index 6bee128..237c183 100644 --- a/demos/demo-webdriver-pool/app/Main.hs +++ b/demos/demo-webdriver-pool/app/Main.hs @@ -4,6 +4,7 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE CPP #-} module Main where @@ -11,6 +12,7 @@ import Control.Concurrent import Control.Exception.Lifted import Control.Monad import Control.Monad.IO.Class +import Control.Monad.IO.Unlift import Data.Maybe import Data.Pool import Data.String.Interpolate @@ -48,8 +50,15 @@ claimWebdriver spec = introduceWith' ( where wrappedAction action = do pool <- getContext webDriverPool + +#if !MIN_VERSION_resource_pool(3,0,0) + withRunInIO $ \runInIO -> + withResource pool $ \sess -> + runInIO $ (void $ action sess) `finally` closeAllSessions sess +#else withResource pool $ \sess -> (void $ action sess) `finally` closeAllSessions sess +#endif -- * Tests diff --git a/demos/demo-webdriver-pool/demo-webdriver-pool.cabal b/demos/demo-webdriver-pool/demo-webdriver-pool.cabal index 05d37ad..7b9bd8f 100644 --- a/demos/demo-webdriver-pool/demo-webdriver-pool.cabal +++ b/demos/demo-webdriver-pool/demo-webdriver-pool.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.35.1. -- -- see: https://github.com/sol/hpack @@ -36,5 +36,6 @@ executable demo-webdriver-pool , sandwich-webdriver , string-interpolate , time + , unliftio-core , webdriver default-language: Haskell2010 diff --git a/demos/demo-webdriver-pool/package.yaml b/demos/demo-webdriver-pool/package.yaml index c5a2a9b..5d31e49 100644 --- a/demos/demo-webdriver-pool/package.yaml +++ b/demos/demo-webdriver-pool/package.yaml @@ -12,6 +12,7 @@ dependencies: - sandwich-webdriver - string-interpolate - time +- unliftio-core - webdriver default-extensions: diff --git a/stack.yaml b/stack.yaml index 29d1434..e76b3af 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,5 +1,5 @@ -resolver: lts-19.22 +resolver: nightly-2023-03-15 packages: - ./sandwich diff --git a/stack.yaml.lock b/stack.yaml.lock index def2ace..409839e 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,19 +5,19 @@ packages: - completed: + commit: 6ea8952a1ed009ae949063ceb3d98bb4f5176dec + git: https://github.com/codedownio/hs-webdriver name: webdriver - version: 0.9.0.1 - git: https://github.com/codedownio/hs-webdriver pantry-tree: - size: 3059 sha256: 0be59abfbfa9de2fb8d80b73f2a12ef051dc1d2c4bce373eafc68b7e07cee964 - commit: 6ea8952a1ed009ae949063ceb3d98bb4f5176dec + size: 3059 + version: 0.9.0.1 original: - git: https://github.com/codedownio/hs-webdriver commit: 6ea8952a1ed009ae949063ceb3d98bb4f5176dec + git: https://github.com/codedownio/hs-webdriver snapshots: - completed: - size: 619399 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/22.yaml - sha256: 5098594e71bdefe0c13e9e6236f12e3414ef91a2b89b029fd30e8fc8087f3a07 - original: lts-19.22 + sha256: c547ded280cb8518065c1c09523faaf2a61e7af4c633ae5de8d657284d87666b + size: 599236 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2023/3/15.yaml + original: nightly-2023-03-15