diff options
Diffstat (limited to 'hsm-repl')
-rw-r--r-- | hsm-repl/Hsm/Repl.hs | 8 | ||||
-rw-r--r-- | hsm-repl/Test/Repl.hs | 2 | ||||
-rw-r--r-- | hsm-repl/hsm-repl.cabal | 2 |
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: |