@@ -457,3 +457,21 @@ readFile fn = do h <- openFile fn Read
457457 if not x then do l <- fread h
458458 readFile' h (contents ++ l)
459459 else return contents
460+
461+------- Some error rewriting
462+
463+%language ErrorReflection
464+
465+cast_part : TT -> ErrorReportPart
466+cast_part (P Bound n t) = TextPart "unknown type"
467+cast_part x = TermPart x
468+
469+%error_handler
470+cast_error : Err -> Maybe (List ErrorReportPart)
471+cast_error (CantResolve `(Cast ~x ~y))
472+ = Just [TextPart "Can't cast from",
473+ cast_part x,
474+ TextPart "to",
475+ cast_part y]
476+cast_error _ = Nothing
477+