mirror of
https://github.com/github/semantic.git
synced 2024-12-01 00:33:59 +03:00
Move NonDetEff stuff to effects and clean up imports
This commit is contained in:
parent
3cdfb81991
commit
c067736a55
@ -8,9 +8,6 @@ module Analysis.Abstract.Evaluating
|
||||
import Control.Abstract.Evaluator
|
||||
import Control.Monad.Effect.Internal (Arrow, relay, interpose)
|
||||
import Control.Monad.Effect
|
||||
import Control.Monad.Effect.Fail
|
||||
import Control.Monad.Effect.Reader
|
||||
import Control.Monad.Effect.State
|
||||
import Control.Monad.Effect.Resumable
|
||||
import Data.Abstract.Configuration
|
||||
import qualified Data.Abstract.Environment as Env
|
||||
|
@ -1,9 +1,8 @@
|
||||
{-# LANGUAGE DataKinds, MultiParamTypeClasses, TypeFamilies, TypeOperators, UndecidableInstances #-}
|
||||
module Control.Effect where
|
||||
|
||||
import qualified Control.Monad.Effect as Effect
|
||||
import Control.Monad.Effect as Effect
|
||||
import Control.Monad.Effect.Fail
|
||||
import Control.Monad.Effect.Internal
|
||||
import Control.Monad.Effect.NonDetEff
|
||||
import Control.Monad.Effect.Reader
|
||||
import Control.Monad.Effect.State
|
||||
@ -61,9 +60,7 @@ instance Monoid w => RunEffect (Writer w) a where
|
||||
-- | 'NonDetEff' effects are interpreted into a nondeterministic set of result values.
|
||||
instance Ord a => RunEffect NonDetEff a where
|
||||
type Result NonDetEff a = Set a
|
||||
runEffect = relay (pure . unit) (\ m k -> case m of
|
||||
MZero -> pure mempty
|
||||
MPlus -> mappend <$> k True <*> k False)
|
||||
runEffect = runNonDetEff unit
|
||||
|
||||
|
||||
-- | Types wrapping 'Eff' actions.
|
||||
|
@ -5,7 +5,7 @@ module Control.Effect.NonDet
|
||||
) where
|
||||
|
||||
import Control.Monad.Effect.Internal
|
||||
import Control.Monad.Effect.NonDetEff
|
||||
import Control.Monad.Effect.NonDetEff as NonDetEff
|
||||
import Prologue
|
||||
|
||||
-- | 'Monad's offering local isolation of nondeterminism effects.
|
||||
@ -18,6 +18,4 @@ class (Alternative m, Monad m) => MonadNonDet m where
|
||||
|
||||
-- | Effect stacks containing 'NonDetEff' offer a 'MonadNonDet' instance which implements 'gather' by interpreting the requests for nondeterminism locally, without removing 'NonDetEff' from the stack—i.e. the _capacity_ for nondeterminism is still present in the effect stack, but any local nondeterminism has been applied.
|
||||
instance (NonDetEff :< fs) => MonadNonDet (Eff fs) where
|
||||
gather f = interpose (pure . f) (\ m k -> case m of
|
||||
MZero -> pure mempty
|
||||
MPlus -> mappend <$> k True <*> k False)
|
||||
gather = NonDetEff.gather
|
||||
|
Loading…
Reference in New Issue
Block a user