Max Heiber
Max Heiber

Reputation: 15582

What does `n` mean in Typed Racket?

n shows up at the type level in error messages, what is it?

Example:

(: trick (All (t u) ((U t (Listof u))  -> (Listof u)))) 
(define (trick x)
    (cond
      [(list? x) x]
     )      
)

Error with this n type:

Type Checker: type mismatch
  expected: (Listof u)
  given: (U (Listof u) (∩ (Pairof Any (Listof Any)) t)) in: x

I tried writing a type signature with n in it and using go-to-definition in Dr. Racket, but it says the symbol is not found.

Upvotes: 1

Views: 65

Answers (1)

Max Heiber
Max Heiber

Reputation: 15582

it's not n, it's (intersection).

Thanks @willness and @molbdnilo.

Upvotes: 1

Related Questions