[racket] Getting an expression to type

From: Spencer Florence (spencer at florence.io)
Date: Sun Jan 26 13:08:24 EST 2014

I'm having difficulty getting the following code to type:

#lang typed/racket
(: test : ((U Number (Parameterof Number)) -> Number))
(define (test p)
  (if (not (parameter? p))
      p
      (p)))

But I get the error:
> Type Checker: Expected Number, but got (U Complex (Parameterof Number))
in: p
On the then branch of the if. Is there a way to convince this to type?

--Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140126/c43ca330/attachment.html>

Posted on the users mailing list.