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:
parent
e9d6a8fb89
commit
f203d4f74b
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user