@@ -5,8 +5,8 @@
55 evaluation/checking inside the proof system, etc. --}
66
77module Idris.Core.ProofState(ProofState(..), newProof, envAtFocus, goalAtFocus,
8− Tactic(..), Goal(..), processTactic, now_elaborating, done_elaborating,
9− dropGiven, keepGiven) where
8+ Tactic(..), Goal(..), processTactic, nowElaboratingPS, doneElaboratingAppPS,
9+ doneElaboratingArgPS, dropGiven, keepGiven) where
1010
1111import Idris.Core.Typecheck
1212import Idris.Core.Evaluate
@@ -224,20 +224,23 @@ unify' ctxt env topx topy =
224224 updateInj (_ : us) inj = updateInj us inj
225225 updateInj [] inj = inj
226226
227−now_elaborating :: Monad m => FC -> Name -> Name -> StateT TState m ()
228−now_elaborating fc f arg = do ps <- get
229− put ps {
230− while_elaborating = FailContext fc f arg : while_elaborating ps
231− }
232−
233−done_elaborating :: Monad m => Name -> Name -> StateT TState m ()
234−done_elaborating f x = do ps <- get
235− let while = while_elaborating ps
236− let while' = dropUntil (\ (FailContext _ f' x') -> f == f' && x == x') while
237− put ps { while_elaborating = while' }
238− where dropUntil p [] = []
239− dropUntil p (x:xs) | p x = xs
240− | otherwise = dropUntil p xs
227+nowElaboratingPS :: FC -> Name -> Name -> ProofState -> ProofState
228+nowElaboratingPS fc f arg ps = ps { while_elaborating = FailContext fc f arg : while_elaborating ps }
229+
230+dropUntil :: (a -> Bool) -> [a] -> [a]
231+dropUntil p [] = []
232+dropUntil p (x:xs) | p x = xs
233+ | otherwise = dropUntil p xs
234+
235+doneElaboratingAppPS :: Name -> ProofState -> ProofState
236+doneElaboratingAppPS f ps = let while = while_elaborating ps
237+ while' = dropUntil (\ (FailContext _ f' _) -> f == f') while
238+ in ps { while_elaborating = while' }
239+
240+doneElaboratingArgPS :: Name -> Name -> ProofState -> ProofState
241+doneElaboratingArgPS f x ps = let while = while_elaborating ps
242+ while' = dropUntil (\ (FailContext _ f' x') -> f == f' && x == x') while
243+ in ps { while_elaborating = while' }
241244
242245getName :: Monad m => String -> StateT TState m Name
243246getName tag = do ps <- get