typed-racket
typed-racket copied to clipboard
Annotating variable failes in match's pattern.
What version of Racket are you using?
Racket 7.7-1
What program did you run?
#lang typed/racket
(match '(cond [#t a b c]
[#f x y z])
[`(cond [,(? boolean? #{preds : (Listof Boolean)})
,(? symbol? #{bodys : (Listof (Listof Symbol))})
...]
...)
bodys])
What should have happened?
In racket:
#lang racket
(match '(cond [#t a b c]
[#f x y z])
[`(cond [,(? boolean? preds)
,(? symbol? bodys)
...]
...)
bodys])
Output is:
'((a b c) (x y z))
If you got an error message, please include it here.
In typed/racket, it failed:
Type Checker: type mismatch
expected: (U (List 'a 'b 'c) (List 'x 'y 'z))
given: (U (List 'b 'c) (List 'y 'z))
in: (match (quote (cond (#t a b c) (#f x y z))) ((quasiquote (cond ((unquote (? boolean? preds)) (unquote (? symbol? bodys)) ...) ...)) bodys))
What version of Racket are you using?
8.0
What program did you run?
#lang typed/racket
(: ls (Pair Number (Listof Number)))
(define ls '(0 1 2 3 4))
(match ls
[`(,(? number? #{nums : (Pair Number (Listof Number))}) ..1)
(displayln nums)])
What should have happened?
Output:
(0 1 2 3 4)
If you got an error message, please include it here.
Type Checker: type mismatch
expected: (Pairof Number (Listof Number))
given: Null
in: (match ls ((quasiquote ((unquote (? number? nums)) ..1)) (displayln nums)))