One of my students is trying to be clever, and combine multiple structure matches in ‘match':
#lang typed/racket (define-type ArithC (U Number plusC multC)) (struct plusC([l : ArithC] [r : ArithC]) #:transparent) (struct multC([l : ArithC] [r : ArithC]) #:transparent) (: num-nums (ArithC -> Number)) (define (num-nums a) (match a [(? number? n) 1] [(or (plusC l r) (multC l r)) (+ (num-nums l) (num-nums r))])) This doesn’t type check, and it appears that the (standard?) problem is that TR can’t untangle the expansion of match well enough to determine that ‘l’ and ‘r’ can’t possibly be ‘false’: Type Checker: type mismatch expected: ArithC given: (U ArithC False plusC multC) in: l Type Checker: type mismatch expected: ArithC given: (U ArithC False plusC multC) in: r Type Checker: Summary: 2 errors encountered in: l r Is this a reasonable summary of this situation? John -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.