[racket] Getting an expression to type
In that case you can use cast until we fix the bug.
(cast p (All (A B) ((A -> B) -> (A -> B))))
On Sun, Jan 26, 2014 at 11:34 AM, Spencer Florence <spencer at florence.io> wrote:
> Unfortunately that was a simplified example. The in the program I'm writing,
> the type isn't Number but (All (A B) ((A -> B) -> (A -> B))), which I can't
> check for with a predicate as far as I know.
>
>
> On Sun, Jan 26, 2014 at 2:31 PM, Eric Dobson <eric.n.dobson at gmail.com>
> wrote:
>>
>> That is definitely a bug, not sure exactly what is going wrong though.
>> Can you file a bug for this?
>>
>> In terms of getting your program to run, if you replace '(not
>> (parameter? p))' with 'number?' it should work.
>>
>> On Sun, Jan 26, 2014 at 10:08 AM, Spencer Florence <spencer at florence.io>
>> wrote:
>> > 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
>> >
>> > ____________________
>> > Racket Users list:
>> > http://lists.racket-lang.org/users
>> >
>
>