aboutsummaryrefslogtreecommitdiff
path: root/hsm-repl/Hsm/Repl.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-repl/Hsm/Repl.hs')
-rw-r--r--hsm-repl/Hsm/Repl.hs8
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"