on master help sign in
Add error handler for Num class
3bee81eEdwin Brady
libs/prelude/Prelude.idr+7
@@ -462,6 +462,7 @@ readFile fn = do h <- openFile fn Read
462
462
463%language ErrorReflection
463%language ErrorReflection
464
464
465+private
465cast_part : TT -> ErrorReportPart
466cast_part : TT -> ErrorReportPart
466cast_part (P Bound n t) = TextPart "unknown type"
467cast_part (P Bound n t) = TextPart "unknown type"
467cast_part x = TermPart x
468cast_part x = TermPart x
@@ -475,3 +476,9 @@ cast_error (CantResolve `(Cast ~x ~y))
475 cast_part y]
476 cast_part y]
476cast_error _ = Nothing
477cast_error _ = Nothing
477
478
479+%error_handler
480+num_error : Err -> Maybe (List ErrorReportPart)
481+num_error (CantResolve `(Num ~x))
482+ = Just [TermPart x, TextPart "is not a numeric type"]
483+num_error _ = Nothing
484+