@@ -1359,6 +1359,8 @@ runTac autoSolve ist fn tac
1359 _ -> fail "Wrong goal type"
1359 _ -> fail "Wrong goal type"
1360 runT ProofState = do g <- goal
1360 runT ProofState = do g <- goal
1361 return ()
1361 return ()
1362+ runT Skip = return ()
1363+ runT (TFail err) = lift . tfail $ ReflectionError [err] (Msg "")
1362 runT x = fail $ "Not implemented " ++ show x
1364 runT x = fail $ "Not implemented " ++ show x
1364 runReflected t = do t' <- reify ist t
1366 runReflected t = do t' <- reify ist t
@@ -1376,6 +1378,7 @@ reify _ (P _ n _) | n == reflm "Trivial" = return Trivial
1376reify _ (P _ n _) | n == reflm "Instance" = return TCInstance
1378reify _ (P _ n _) | n == reflm "Instance" = return TCInstance
1377reify _ (P _ n _) | n == reflm "Solve" = return Solve
1379reify _ (P _ n _) | n == reflm "Solve" = return Solve
1378reify _ (P _ n _) | n == reflm "Compute" = return Compute
1380reify _ (P _ n _) | n == reflm "Compute" = return Compute
1381+reify _ (P _ n _) | n == reflm "Skip" = return Skip
1379reify ist t@(App _ _)
1382reify ist t@(App _ _)
1380 | (P _ f _, args) <- unApply t = reifyApp ist f args
1383 | (P _ f _, args) <- unApply t = reifyApp ist f args
1381reify _ t = fail ("Unknown tactic " ++ show t)
1384reify _ t = fail ("Unknown tactic " ++ show t)
@@ -1416,6 +1419,15 @@ reifyApp ist t [n, tt', t']
1416 tt'' <- reifyTT tt'
1419 tt'' <- reifyTT tt'
1417 t'' <- reifyTT t'
1420 t'' <- reifyTT t'
1418 return $ LetTacTy n' (delab ist tt'') (delab ist t'')
1421 return $ LetTacTy n' (delab ist tt'') (delab ist t'')
1422+reifyApp ist t [errs]
1423+ | t == reflm "Fail" = case unList errs of
1424+ Nothing -> fail "Failed to reify errors"
1426+ let parts = mapM reifyReportPart errs' in
1428+ Left err -> fail $ "Couldn't reify \"Fail\" tactic - " ++ show err
1430+ return $ TFail errs''
1419reifyApp _ f args = fail ("Unknown tactic " ++ show (f, args)) -- shouldn't happen
1431reifyApp _ f args = fail ("Unknown tactic " ++ show (f, args)) -- shouldn't happen
1421-- | Reify terms from their reflected representation
1433-- | Reify terms from their reflected representation
@@ -2042,10 +2054,10 @@ reflErrName n = sNS (sUN n) ["Errors", "Reflection", "Language"]
2042-- representation. Not in Idris or ElabD monads because it should be usable
2054-- representation. Not in Idris or ElabD monads because it should be usable
2043-- from either.
2055-- from either.
2044reifyReportPart :: Term -> Either Err ErrorReportPart
2056reifyReportPart :: Term -> Either Err ErrorReportPart
2045−reifyReportPart (App (P (DCon _ _) n _) (Constant (Str msg))) | n == reflErrName "TextPart" =
2057+reifyReportPart (App (P (DCon _ _) n _) (Constant (Str msg))) | n == reflm "TextPart" =
2046 Right (TextPart msg)
2058 Right (TextPart msg)
2047reifyReportPart (App (P (DCon _ _) n _) ttn)
2059reifyReportPart (App (P (DCon _ _) n _) ttn)
2048− | n == reflErrName "NamePart" =
2060+ | n == reflm "NamePart" =
2049 case runElab [] (reifyTTName ttn) (initElaborator NErased initContext Erased) of
2061 case runElab [] (reifyTTName ttn) (initElaborator NErased initContext Erased) of
2050 Error e -> Left . InternalMsg $
2062 Error e -> Left . InternalMsg $
2051 "could not reify name term " ++
2063 "could not reify name term " ++
@@ -2053,7 +2065,7 @@ reifyReportPart (App (P (DCon _ _) n _) ttn)
2053 " when reflecting an error:" ++ show e
2065 " when reflecting an error:" ++ show e
2054 OK (n', _)-> Right $ NamePart n'
2066 OK (n', _)-> Right $ NamePart n'
2055reifyReportPart (App (P (DCon _ _) n _) tm)
2067reifyReportPart (App (P (DCon _ _) n _) tm)
2056− | n == reflErrName "TermPart" =
2068+ | n == reflm "TermPart" =
2057 case runElab [] (reifyTT tm) (initElaborator NErased initContext Erased) of
2069 case runElab [] (reifyTT tm) (initElaborator NErased initContext Erased) of
2058 Error e -> Left . InternalMsg $
2070 Error e -> Left . InternalMsg $
2059 "could not reify reflected term " ++
2071 "could not reify reflected term " ++
@@ -2061,7 +2073,7 @@ reifyReportPart (App (P (DCon _ _) n _) tm)
2061 " when reflecting an error:" ++ show e
2073 " when reflecting an error:" ++ show e
2062 OK (tm', _) -> Right $ TermPart tm'
2074 OK (tm', _) -> Right $ TermPart tm'
2063reifyReportPart (App (P (DCon _ _) n _) tm)
2075reifyReportPart (App (P (DCon _ _) n _) tm)
2064− | n == reflErrName "SubReport" =
2076+ | n == reflm "SubReport" =
2065 case unList tm of
2077 case unList tm of
2066 Just xs -> do subParts <- mapM reifyReportPart xs
2078 Just xs -> do subParts <- mapM reifyReportPart xs
2067 Right (SubReport subParts)
2079 Right (SubReport subParts)