Created
March 5, 2014 18:28
-
-
Save greghendershott/9373439 to your computer and use it in GitHub Desktop.
Typed Racket error message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang typed/racket | |
(: foo (Real -> (Integer -> Float))) | |
(define (foo n) | |
(const n)) | |
; /tmp/tr.rkt:5:2: Type Checker: Polymorphic function `const' could not be applied to arguments: | |
; Argument 1: | |
; Expected: a | |
; Given: Real | |
; | |
; Result type: (Any * -> a) | |
; Expected result: (Integer -> Flonum) | |
; | |
; in: (const n) | |
;;; IMHO the following format would be easier to grok: | |
; /tmp/tr.rkt:5:2: Type Checker: Polymorphic function `const' could not be applied to arguments: | |
; Argument 1: | |
; Expected: a | |
; Given: Real | |
; Result: | |
; Expected: (Integer -> Flonum) | |
; Given: (Any * -> a) | |
; in: (const n) | |
;;; 1. Consistent order for expected vs. given, for arguments and result. | |
;;; 2. No blank lines; confusing with multiple errors in a row. | |
;;; p.s. A non-formatting point: It would be great if the error | |
;;; message for Argument 1 could somehow say, "Expected: Flonum", | |
;;; since that's the actual fix to make. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment