mirror of
https://github.com/github/semantic.git
synced 2025-01-04 13:34:31 +03:00
Make the ref parameter throw on failure.
This commit is contained in:
parent
e0e8b1b566
commit
9116072186
@ -71,7 +71,7 @@ class (Show1 constr, Foldable constr) => Evaluatable constr where
|
|||||||
, Show address
|
, Show address
|
||||||
)
|
)
|
||||||
=> (term -> Evaluator term address value m (ValueRef address value))
|
=> (term -> Evaluator term address value m (ValueRef address value))
|
||||||
-> (term -> Evaluator term address value m (Maybe (Slot address)))
|
-> (term -> Evaluator term address value m (Slot address))
|
||||||
-> (constr term -> Evaluator term address value m (ValueRef address value))
|
-> (constr term -> Evaluator term address value m (ValueRef address value))
|
||||||
eval recur _ expr = do
|
eval recur _ expr = do
|
||||||
traverse_ recur expr
|
traverse_ recur expr
|
||||||
@ -93,7 +93,7 @@ class (Show1 constr, Foldable constr) => Evaluatable constr where
|
|||||||
, Ord address
|
, Ord address
|
||||||
)
|
)
|
||||||
=> (term -> Evaluator term address value m value)
|
=> (term -> Evaluator term address value m value)
|
||||||
-> (term -> Evaluator term address value m (Maybe (Slot address)))
|
-> (term -> Evaluator term address value m (Slot address))
|
||||||
-> (constr term -> Evaluator term address value m (Maybe (Slot address)))
|
-> (constr term -> Evaluator term address value m (Maybe (Slot address)))
|
||||||
ref _ _ _ = pure Nothing
|
ref _ _ _ = pure Nothing
|
||||||
|
|
||||||
|
@ -150,4 +150,4 @@ evalTerm :: ( Carrier sig m
|
|||||||
)
|
)
|
||||||
=> Open (term -> Evaluator term address value m (ValueRef address value))
|
=> Open (term -> Evaluator term address value m (ValueRef address value))
|
||||||
-> term -> Evaluator term address value m (ValueRef address value)
|
-> term -> Evaluator term address value m (ValueRef address value)
|
||||||
evalTerm perTerm = fst (fix (\ (ev, re) -> (perTerm (eval ev re . project), ref (ev >=> value) re . project)))
|
evalTerm perTerm = fst (fix (\ (ev, re) -> (perTerm (eval ev (re >=> maybeM (throwEvalError RefError)) . project), ref (ev >=> value) (re >=> maybeM (throwEvalError RefError)) . project)))
|
||||||
|
Loading…
Reference in New Issue
Block a user