1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Define a convenience for throwing a free variable error.

This commit is contained in:
Rob Rix 2018-05-07 15:45:10 -04:00
parent e9d6a8fb89
commit f203d4f74b

View File

@ -13,6 +13,7 @@ module Control.Abstract.Environment
, lookupEnv
, lookupWith
, EnvironmentError(..)
, freeVariableError
, runEnvironmentError
, runEnvironmentErrorWith
) where
@ -84,6 +85,9 @@ deriving instance Show (EnvironmentError value return)
instance Show1 (EnvironmentError value) where liftShowsPrec _ _ = showsPrec
instance Eq1 (EnvironmentError value) where liftEq _ (FreeVariable n1) (FreeVariable n2) = n1 == n2
freeVariableError :: Member (Resumable (EnvironmentError value)) effects => Name -> Evaluator location term value effects value
freeVariableError = throwResumable . FreeVariable
runEnvironmentError :: Evaluator location term value (Resumable (EnvironmentError value) ': effects) a -> Evaluator location term value effects (Either (SomeExc (EnvironmentError value)) a)
runEnvironmentError = raiseHandler runError