diff --git a/src/Bergamot/Rules.elm b/src/Bergamot/Rules.elm index 8c0cb05..b31f13b 100644 --- a/src/Bergamot/Rules.elm +++ b/src/Bergamot/Rules.elm @@ -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 =