aboutsummaryrefslogtreecommitdiff
path: root/hsm-repl
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-08-20 19:10:16 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-08-23 22:59:12 +0000
commit82b02509150b615360118ca381ad8c9fd39d2f29 (patch)
tree97118f30a334a7b1fc9b6b7f6a8bbcbc87ae5aeb /hsm-repl
parentdea39a25938662e6af932bc9a957073d8364dde1 (diff)
Falls back to `bracket` unless `releaseEff` is needed
Diffstat (limited to 'hsm-repl')
-rw-r--r--hsm-repl/Hsm/Repl.hs8
-rw-r--r--hsm-repl/Test/Repl.hs2
-rw-r--r--hsm-repl/hsm-repl.cabal2
3 files changed, 3 insertions, 9 deletions
diff --git a/hsm-repl/Hsm/Repl.hs b/hsm-repl/Hsm/Repl.hs
index bcde6ad..1da7493 100644
--- a/hsm-repl/Hsm/Repl.hs
+++ b/hsm-repl/Hsm/Repl.hs
@@ -17,7 +17,7 @@ import Effectful.Dispatch.Static
, getStaticRep
, unsafeEff_
)
-import Effectful.Resource (Resource, allocateEff)
+import Effectful.Exception (bracket)
import GHC.TypeLits (KnownSymbol, Symbol, symbolVal)
import Generic.Data.Function.Common.Generic.Meta (KnownSymbols, symbolVals)
import Hsm.Log (Log, Severity (Attention, Info, Trace), logMsg)
@@ -89,12 +89,10 @@ repl = query >>= maybe (return Nothing) parse
runRepl
:: forall p ms t es a
- . (IOE :> es, Log "repl" :> es, Resource :> es)
+ . (IOE :> es, Log "repl" :> es)
=> Eff (Repl p ms t : es) a
-> Eff es a
-runRepl action = do
- inputState <- snd <$> allocateEff inputStateAlloc inputStateDealloc
- evalStaticRep (Repl inputState) action
+runRepl action = bracket inputStateAlloc inputStateDealloc $ \inputState -> evalStaticRep (Repl inputState) action
where
inputStateAlloc = do
logMsg Info "Initializing input"
diff --git a/hsm-repl/Test/Repl.hs b/hsm-repl/Test/Repl.hs
index 9052ef1..3b0e534 100644
--- a/hsm-repl/Test/Repl.hs
+++ b/hsm-repl/Test/Repl.hs
@@ -2,7 +2,6 @@ import Control.Monad (void)
import Control.Monad.Loops (whileJust_)
import Data.Function ((&))
import Effectful (runEff)
-import Effectful.Resource (runResource)
import Hsm.Log (Severity (Trace), runLog)
import Hsm.Repl (repl, runRepl)
@@ -11,5 +10,4 @@ main =
void (whileJust_ repl return)
& runRepl @"exec-repl λ " @'["Prelude"] @[Bool]
& runLog @"repl" Trace
- & runResource
& runEff
diff --git a/hsm-repl/hsm-repl.cabal b/hsm-repl/hsm-repl.cabal
index b37e923..eb755a6 100644
--- a/hsm-repl/hsm-repl.cabal
+++ b/hsm-repl/hsm-repl.cabal
@@ -12,7 +12,6 @@ library
, haskeline
, hint
, hsm-log
- , resourcet-effectful
default-language: GHC2024
exposed-modules: Hsm.Repl
@@ -30,7 +29,6 @@ executable test-repl
, hint
, hsm-log
, monad-loops
- , resourcet-effectful
default-language: GHC2024
ghc-options: