[racket] Two questions about scribbling a Typed Racket library

6 views
Skip to first unread message

Neil Toronto

unread,
May 30, 2012, 6:33:51 PM5/30/12
to us...@racket-lang.org
How do I get primitive type names linked to their definitions? When I
(require (for-label typed/racket)), I get this error:

module: identifier already imported for label from a different source in:
#%module-begin
typed/racket
typed/racket

Also, what's the best way to document a type, when the type's definition
is important? I'd like something like this:

Flomap-Transform = (Integer Integer -> invertible-2d-mapping)

instead of having to write "This type is defined as..." in the
description text.

Neil ⊥
____________________
Racket Users list:
http://lists.racket-lang.org/users

Sam Tobin-Hochstadt

unread,
May 30, 2012, 11:20:42 PM5/30/12
to Neil Toronto, us...@racket-lang.org
On Wed, May 30, 2012 at 6:33 PM, Neil Toronto <neil.t...@gmail.com> wrote:
> How do I get primitive type names linked to their definitions? When I
> (require (for-label typed/racket)), I get this error:
>
> module: identifier already imported for label from a different source in:
>  #%module-begin
>  typed/racket
>  typed/racket

You need to use `except-in` to hide `#%module-begin`. The Typed
Racket docs themselves should have examples of this.

> Also, what's the best way to document a type, when the type's definition is
> important? I'd like something like this:
>
>  Flomap-Transform = (Integer Integer -> invertible-2d-mapping)
>
> instead of having to write "This type is defined as..." in the description
> text.

There's not currently a nice way of defining constants in Scribble
that I know of.
--
sam th
sa...@ccs.neu.edu

Jay McCarthy

unread,
May 31, 2012, 4:39:23 PM5/31/12
to Sam Tobin-Hochstadt, us...@racket-lang.org
On Wed, May 30, 2012 at 9:20 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> wrote:
> On Wed, May 30, 2012 at 6:33 PM, Neil Toronto <neil.t...@gmail.com> wrote:
>> Also, what's the best way to document a type, when the type's definition is
>> important? I'd like something like this:
>>
>>  Flomap-Transform = (Integer Integer -> invertible-2d-mapping)
>>
>> instead of having to write "This type is defined as..." in the description
>> text.
>
> There's not currently a nice way of defining constants in Scribble
> that I know of.

I normally use

@defthing[id contract]{Equivalent to @racket[definition]}

Jay

--
Jay McCarthy <j...@cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Reply all
Reply to author
Forward
0 new messages