[plt-scheme] Typed Scheme: Expected Number, but got Number

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Jan 26 02:53:56 EST 2010

On Mon, Jan 25, 2010 at 10:32 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> There are two problems here.
>
> 1. The error message shouldn't say "Number" in both places.  I can't
> duplicate this behavior.  Can you tell me something more about how you
> got this?

I built from source yesterday, typed the program in, and got the error
message. That is (more or less) it.

> 2. In the `typed-scheme' language `Number' == `Real', and
> `string->number' produces `Complex'.  So this won't work.  If you
> change the type annotation to `Complex', the program works.

I'm a little unclear here. You're saying you have a development
version where this is the case? 'cause it sure ain't the case with the
trunk:

> string->number
- : (case-lambda (String -> (U Number False)) (String Number -> (U
Number False)))

More generally, how do I convert between numeric types? There are a
bunch of types, like Exact-Rational and Integer, that I don't know how
to work with. (Like, how do I go Number -> Integer?)

Tnx,
N.


Posted on the users mailing list.