diff --git a/semantic.cabal b/semantic.cabal index a1fe5c2a6..89f73bbc5 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -189,7 +189,6 @@ library , Semantic.Parse , Semantic.REPL , Semantic.Resolution - , Semantic.Resource , Semantic.Task , Semantic.Telemetry , Semantic.Telemetry.AsyncQueue diff --git a/src/Parsing/TreeSitter.hs b/src/Parsing/TreeSitter.hs index 6b93e2b52..e1a3e32e0 100644 --- a/src/Parsing/TreeSitter.hs +++ b/src/Parsing/TreeSitter.hs @@ -8,6 +8,7 @@ import Prologue hiding (bracket) import qualified Control.Exception as Exc (bracket) import Control.Monad.Effect +import Control.Monad.Effect.Resource import Control.Monad.Effect.Trace import Control.Monad.IO.Class import Data.ByteString.Unsafe (unsafeUseAsCStringLen) @@ -22,7 +23,6 @@ import Data.Location import Data.Source import Data.Span import Data.Term -import Semantic.Resource import Semantic.Timeout import qualified TreeSitter.Language as TS diff --git a/src/Semantic/REPL.hs b/src/Semantic/REPL.hs index 7e2e9aa39..09ac3523e 100644 --- a/src/Semantic/REPL.hs +++ b/src/Semantic/REPL.hs @@ -5,6 +5,7 @@ module Semantic.REPL ) where import Control.Abstract hiding (Continue, List, string) +import Control.Monad.Effect.Resource import Control.Monad.IO.Class import Data.Abstract.Address.Precise as Precise import Data.Abstract.Environment as Env @@ -31,7 +32,6 @@ import Semantic.Distribute import Semantic.Graph import Semantic.IO as IO import Semantic.Resolution -import Semantic.Resource import Semantic.Task hiding (Error) import Semantic.Telemetry import Semantic.Timeout diff --git a/src/Semantic/Resource.hs b/src/Semantic/Resource.hs deleted file mode 100644 index 2672115fa..000000000 --- a/src/Semantic/Resource.hs +++ /dev/null @@ -1,36 +0,0 @@ -{-# LANGUAGE GADTs, TypeOperators, RankNTypes #-} - -module Semantic.Resource - ( Resource (..) - , bracket - , runResource - ) where - -import Control.Monad.Effect -import Control.Monad.IO.Class -import qualified Control.Exception as Exc - -data Resource m output where - Resource :: m res -> (res -> m any) -> (res -> m output) -> Resource m output - -instance PureEffect Resource -instance Effect Resource where - handleState c dist (Request (Resource fore aft go) k) - = Request (Resource (dist (fore <$ c)) (dist . fmap aft) (dist . fmap go)) (dist . fmap k) - -bracket :: (Member Resource effs, Effectful m) - => m effs res - -> (res -> m effs any) - -> (res -> m effs b) - -> m effs b -bracket fore aft go = send (Resource (lowerEff fore) (lowerEff . aft) (lowerEff . go)) - -runResource :: (Member (Lift IO) effects, PureEffects effects) - => (forall x . Eff effects x -> IO x) - -> Eff (Resource ': effects) a - -> Eff effects a -runResource handler = interpret (\(Resource fore aft go) - -> liftIO (Exc.bracket - (handler (runResource handler fore)) - (handler . runResource handler . aft) - (handler . runResource handler . go))) diff --git a/src/Semantic/Task.hs b/src/Semantic/Task.hs index 2ed12b653..c115d0676 100644 --- a/src/Semantic/Task.hs +++ b/src/Semantic/Task.hs @@ -62,6 +62,7 @@ import Control.Monad import Control.Monad.Effect import Control.Monad.Effect.Exception import Control.Monad.Effect.Reader +import Control.Monad.Effect.Resource import Control.Monad.Effect.Trace import Data.Blob import Data.Bool @@ -86,7 +87,6 @@ import Semantic.Distribute import Semantic.Timeout import qualified Semantic.IO as IO import Semantic.Resolution -import Semantic.Resource import Semantic.Telemetry import Serializing.Format hiding (Options) import System.Exit (die) diff --git a/test/Rendering/TOC/Spec.hs b/test/Rendering/TOC/Spec.hs index d6b4e2f14..0317fcb5f 100644 --- a/test/Rendering/TOC/Spec.hs +++ b/test/Rendering/TOC/Spec.hs @@ -16,7 +16,7 @@ import Data.Sum import Data.Term import Data.Text (Text) import Data.Text.Encoding (encodeUtf8) -import Data.Union +import Data.Union hiding (forAll) import Diffing.Algorithm import Diffing.Interpreter import Prelude diff --git a/vendor/effects b/vendor/effects index 8ded4a641..e7858dacc 160000 --- a/vendor/effects +++ b/vendor/effects @@ -1 +1 @@ -Subproject commit 8ded4a64133ce77ddd2fc734f455753e62af0ad3 +Subproject commit e7858dacce6fbb43e76a49e4dbeff1f1815aa290