Avoid checking for out-of-gas on each 'andThen'
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
d6d610c038
commit
18d524a0d2
|
@ -33,7 +33,7 @@ type alias Prover a = RuleEnv -> ProveState -> Search (a, ProveState)
|
|||
andThen : (a -> Prover b) -> Prover a -> Prover b
|
||||
andThen f p env ps =
|
||||
p env ps
|
||||
|> Search.andThen (\(a, psp) -> if psp.gas > 0 then (f a) env psp else Search.fail)
|
||||
|> Search.andThen (\(a, psp) -> (f a) env psp)
|
||||
|
||||
join : Prover (Prover a) -> Prover a
|
||||
join p = andThen (\x -> x) p
|
||||
|
@ -75,7 +75,7 @@ getUnificationState : Prover UnificationState
|
|||
getUnificationState env ps = Search.pure (ps.unificationState, ps)
|
||||
|
||||
burn : Prover ()
|
||||
burn env ps = Search.pure ((), { ps | gas = ps.gas - 1})
|
||||
burn env ps = if ps.gas > 0 then Search.pure ((), { ps | gas = ps.gas - 1}) else Search.fail
|
||||
|
||||
liftInstantiation : (a -> InstantiationState -> (b, InstantiationState)) -> a -> Prover b
|
||||
liftInstantiation f a env ps =
|
||||
|
|
Loading…
Reference in New Issue
Block a user