1
votes

I'm trying to do use the science.plt module in a typed racket program, but I'm having a hard time understanding how to use the require/typed form properly. I've read the docs repeatedly, but I guess I don't quite understand what exactly I'm trying to produce with the form.

In the

[struct name ([f : t] ...)]

form, is the name a name I should expect to find in the module I want to require, or am I making it up for use within my own program?

Probably the most helpful thing for me would be an example or three of require/typed applied to untyped racket modules.

Or if I'm misunderstanding this real deeply and one cannot use untyped modules in a typed program, how should I go about structuring things? I really just need the random number and random distribution functionality from the science.plt module, and don't expect to have any other imports, at this point.

1

1 Answers

1
votes

Did you have a look at the Typed Racket reference page for require/typed? There are several examples there showing how to import from untyped modules.

The name expression in the [#:struct name ([f : t] ...) struct-option ...] clause is supposed to be the name of a structure type.

That is, if you have a struct like (struct point (x y), the name is supposed to be point.