1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Define a parameterized handler for Unspecialized errors.

This commit is contained in:
Rob Rix 2018-05-06 17:05:34 -04:00
parent 3a79bc0dc3
commit 55997e5c60
2 changed files with 5 additions and 1 deletions

View File

@ -13,4 +13,4 @@ import Prologue
--
-- > resumingBadSyntax . …
resumingBadSyntax :: AbstractHole value => Evaluator location term value (Resumable (Unspecialized value) ': effects) a -> Evaluator location term value effects a
resumingBadSyntax = raiseHandler (relay pure (\ (Resumable err@(Unspecialized _)) yield -> traceM ("Unspecialized:" <> show err) *> yield hole))
resumingBadSyntax = runUnspecializedWith (\ err@(Unspecialized _) -> traceM ("Unspecialized:" <> show err) *> pure hole)

View File

@ -4,6 +4,7 @@ module Data.Abstract.Evaluatable
, Evaluatable(..)
, Unspecialized(..)
, runUnspecialized
, runUnspecializedWith
, EvalError(..)
, runEvalError
, runEvalErrorWith
@ -203,6 +204,9 @@ instance Show1 (Unspecialized a) where
runUnspecialized :: Evaluator location term value (Resumable (Unspecialized value) ': effects) a -> Evaluator location term value effects (Either (SomeExc (Unspecialized value)) a)
runUnspecialized = raiseHandler runError
runUnspecializedWith :: (forall resume . Unspecialized value resume -> Evaluator location term value effects resume) -> Evaluator location term value (Resumable (Unspecialized value) ': effects) a -> Evaluator location term value effects a
runUnspecializedWith = runResumableWith
-- Instances