diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-08-20 19:10:16 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-08-23 22:59:12 +0000 |
commit | 82b02509150b615360118ca381ad8c9fd39d2f29 (patch) | |
tree | 97118f30a334a7b1fc9b6b7f6a8bbcbc87ae5aeb /hsm-repl/Hsm/Repl.hs | |
parent | dea39a25938662e6af932bc9a957073d8364dde1 (diff) |
Falls back to `bracket` unless `releaseEff` is needed
Diffstat (limited to 'hsm-repl/Hsm/Repl.hs')
-rw-r--r-- | hsm-repl/Hsm/Repl.hs | 8 |
1 files changed, 3 insertions, 5 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" |