utils: Explicitly document the untyped submodule.

This commit is contained in:
Sergiu Ivanov 2022-04-07 00:21:48 +02:00
parent 650801a6d2
commit b1613ac1f7

View file

@ -392,10 +392,10 @@ a couple conversions.
(lists-transpose '((a b) (1 2 3) (#t)))
]
As of 2022-03-31, Typed Racket cannot convert the type of
@racket[lists-transpose] to a contract. To use @racket[lists-transpose] from
untyped code, require it from the @racket[untyped] submodule: @racket[(require
(submod dds/utils untyped))].
As of 2022-04-07, Typed Racket cannot convert the type of
@racket[lists-transpose] to a contract. The @seclink["untyped"]{untyped
submodule} provides a version of this function which can be used in
untyped code.
}
@ -516,3 +516,32 @@ Converts 0 to @racket[#f] and 1 to @racket[#t].
(01->boolean 0)
(01->boolean 1)
]}
@section[#:tag "untyped"]{Untyped code}
@defmodule[(submod dds/utils untyped)]
@(require (for-label (only-in racket/contract/base listof any/c)))
This submodule contains some functions whose types cannot be converted to
contracts by Typed Racket.
@(define utils-evaluator/untyped
(parameterize ([sandbox-output 'string]
[sandbox-error-output 'string]
[sandbox-memory-limit 50])
(make-evaluator 'racket #:requires '((submod "utils.rkt" untyped)))))
@defproc[(lists-transpose [lists (listof (listof any/c))])
(listof (listof any/c))]{
Transposes a list of lists. The length of the resulting list is the length of
the shortest list in @racket[lists].
This function is essentially @racket[in-parallel], wrapped in
a couple conversions.
@examples[#:eval utils-evaluator/untyped
(lists-transpose '((a b) (1 2)))
(lists-transpose '((a b) (1 2 3) (#t)))
]}