mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Define throwEnvironmentError
This commit is contained in:
parent
7169324be8
commit
3819f31647
@ -20,11 +20,15 @@ module Control.Abstract.Environment
|
||||
, runEnvironmentErrorWith
|
||||
) where
|
||||
|
||||
import Control.Abstract.Context (currentErrorContext)
|
||||
import Control.Abstract.Evaluator
|
||||
import Data.Abstract.ErrorContext
|
||||
import Data.Abstract.Environment (Bindings, Environment)
|
||||
import qualified Data.Abstract.Environment as Env
|
||||
import Data.Abstract.Exports as Exports
|
||||
import Data.Abstract.Module
|
||||
import Data.Abstract.Name
|
||||
import Data.Span
|
||||
import Prologue
|
||||
|
||||
-- | Retrieve the environment.
|
||||
@ -137,3 +141,11 @@ runEnvironmentError = runResumable
|
||||
|
||||
runEnvironmentErrorWith :: (Effectful (m address value), Effects effects) => (forall resume . EnvironmentError address resume -> m address value effects resume) -> m address value (Resumable (EnvironmentError address) ': effects) a -> m address value effects a
|
||||
runEnvironmentErrorWith = runResumableWith
|
||||
|
||||
throwEnvironmentError :: ( Member (Resumable (BaseError (EnvironmentError address))) effects
|
||||
, Member (Reader ModuleInfo) effects
|
||||
, Member (Reader Span) effects
|
||||
)
|
||||
=> EnvironmentError address resume
|
||||
-> Evaluator address value effects resume
|
||||
throwEnvironmentError err = currentErrorContext >>= \ errorContext -> throwResumable $ BaseError errorContext err
|
||||
|
Loading…
Reference in New Issue
Block a user