mirror of
https://github.com/github/semantic.git
synced 2024-12-20 13:21:59 +03:00
Add ConstructorError and ScopedEnvError
This commit is contained in:
parent
04e257991a
commit
283284e91e
@ -171,21 +171,25 @@ data EvalError address value return where
|
||||
NoNameError :: EvalError address value Name
|
||||
RationalFormatError :: Text -> EvalError address value Rational
|
||||
ReferenceError :: value -> Name -> EvalError address value (ValueRef address value)
|
||||
ConstructorError :: Name -> EvalError address value address
|
||||
ScopedEnvError :: value -> EvalError address value address
|
||||
|
||||
deriving instance (Eq address, Eq value) => Eq (EvalError address value return)
|
||||
deriving instance (Show address, Show value) => Show (EvalError address value return)
|
||||
|
||||
instance NFData value => NFData1 (EvalError address value) where
|
||||
liftRnf _ x = case x of
|
||||
DerefError v -> rnf v
|
||||
DefaultExportError -> ()
|
||||
ExportError p n -> rnf p `seq` rnf n
|
||||
FloatFormatError i -> rnf i
|
||||
IntegerFormatError i -> rnf i
|
||||
NoNameError -> ()
|
||||
RationalFormatError i -> rnf i
|
||||
ReferenceError v n -> rnf v `seq` rnf n
|
||||
DerefError v -> rnf v
|
||||
DefaultExportError -> ()
|
||||
ExportError p n -> rnf p `seq` rnf n
|
||||
FloatFormatError i -> rnf i
|
||||
IntegerFormatError i -> rnf i
|
||||
NoNameError -> ()
|
||||
RationalFormatError i -> rnf i
|
||||
ReferenceError v n -> rnf v `seq` rnf n
|
||||
QualifiedImportError i -> rnf i
|
||||
ConstructorError n -> rnf n
|
||||
ScopedEnvError v -> rnf v
|
||||
|
||||
instance (NFData value, NFData return) => NFData (EvalError address value return) where
|
||||
rnf = liftRnf rnf
|
||||
|
@ -366,15 +366,17 @@ resumingEvalError :: ( Carrier sig m
|
||||
m)) a
|
||||
-> Evaluator term address value m a
|
||||
resumingEvalError = runEvalErrorWith (\ baseError -> traceError "EvalError" baseError *> case baseErrorException baseError of
|
||||
ConstructorError _ -> pure hole
|
||||
ScopedEnvError _ -> pure hole
|
||||
QualifiedImportError{} -> pure hole
|
||||
DerefError{} -> pure hole
|
||||
ReferenceError{} -> pure hole
|
||||
DefaultExportError{} -> pure ()
|
||||
ExportError{} -> pure ()
|
||||
IntegerFormatError{} -> pure 0
|
||||
FloatFormatError{} -> pure 0
|
||||
RationalFormatError{} -> pure 0
|
||||
NoNameError -> gensym)
|
||||
DerefError{} -> pure hole
|
||||
ReferenceError{} -> pure hole
|
||||
DefaultExportError{} -> pure ()
|
||||
ExportError{} -> pure ()
|
||||
IntegerFormatError{} -> pure 0
|
||||
FloatFormatError{} -> pure 0
|
||||
RationalFormatError{} -> pure 0
|
||||
NoNameError -> gensym)
|
||||
|
||||
resumingUnspecialized :: ( AbstractHole value
|
||||
, Carrier sig m
|
||||
|
Loading…
Reference in New Issue
Block a user