mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
Lift runM into Effectful contexts.
This commit is contained in:
parent
c153815859
commit
1320d6a9c0
@ -8,6 +8,7 @@ module Control.Effect
|
||||
, throwResumable
|
||||
-- * Handlers
|
||||
, run
|
||||
, runM
|
||||
, runEffect
|
||||
, raiseHandler
|
||||
, runReader
|
||||
@ -53,6 +54,9 @@ throwResumable = raise . throwError
|
||||
run :: Effectful m => m '[] a -> a
|
||||
run = Eff.run . lower
|
||||
|
||||
runM :: (Effectful m, Monad f) => m '[f] a -> f a
|
||||
runM = Eff.runM . lower
|
||||
|
||||
runEffect :: Effectful m => (forall v . effect v -> (v -> m effects a) -> m effects a) -> m (effect ': effects) a -> m effects a
|
||||
runEffect handler = raiseHandler (Eff.relay pure (\ effect yield -> lower (handler effect (raise . yield))))
|
||||
|
||||
|
@ -7,7 +7,6 @@ import Analysis.Abstract.Collecting
|
||||
import Analysis.Abstract.Evaluating as X
|
||||
import Control.Abstract.Evaluator
|
||||
import Control.Effect (runPrintingTraces)
|
||||
import Control.Monad.Effect (runM)
|
||||
import Data.Abstract.Address
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Abstract.Value
|
||||
@ -27,7 +26,7 @@ import qualified Language.Python.Assignment as Python
|
||||
import qualified Language.Ruby.Assignment as Ruby
|
||||
|
||||
justEvaluating
|
||||
= runM . lower
|
||||
= runM
|
||||
. fmap (first reassociate)
|
||||
. evaluating
|
||||
. runPrintingTraces
|
||||
@ -41,7 +40,7 @@ justEvaluating
|
||||
. constrainedToValuePrecise
|
||||
|
||||
evaluatingWithHoles
|
||||
= runM . lower
|
||||
= runM
|
||||
. evaluating
|
||||
. runPrintingTraces
|
||||
. resumingLoadError
|
||||
@ -55,7 +54,7 @@ evaluatingWithHoles
|
||||
|
||||
-- The order is significant here: caching has to run before typeChecking, or else we’ll nondeterministically produce TypeErrors as part of the result set. While this is probably actually correct, it will require us to have an Ord instance for TypeError, which we don’t have yet.
|
||||
checking
|
||||
= runM . lower
|
||||
= runM
|
||||
. fmap (first reassociate)
|
||||
. evaluating
|
||||
. runPrintingTraces
|
||||
|
Loading…
Reference in New Issue
Block a user