Switch utils to Typed Racket.

This commit is contained in:
Sergiu Ivanov 2022-03-05 13:41:40 +01:00
parent f62d53ed8f
commit 97d4c18305
2 changed files with 497 additions and 532 deletions

View File

@ -1,7 +1,7 @@
#lang scribble/manual
@(require scribble/example racket/sandbox
(for-label typed/racket/base graph
(submod "../utils.rkt" typed)
"../utils.rkt"
(only-in typed/graph Graph)
(only-in racket/set set)
(only-in racket/stream stream->list stream-take)))
@ -14,20 +14,11 @@ This module defines miscellaneous utilities, supporting the other modules of
the package: evaluating sexps, manipulating lists,
@hyperlink["https://orgmode.org/"]{Org-mode} interoperability, etc.
@bold{Note:} I am currently migrating this module to Typed Racket.
This documentation only lists the functions and the types which have already
been converted. However, the typed part is currently hidden in an untyped
module, so you cannot yet use the types directly.
@bold{TODO:} Hyperlinks are currently broken in this document because it
actually documents a submodule. Fix them once the migration to Typed Racket
has reached a fixed point.
@(define utils-evaluator
(parameterize ([sandbox-output 'string]
[sandbox-error-output 'string]
[sandbox-memory-limit 50])
(make-evaluator 'typed/racket #:requires '((submod "utils.rkt" typed)))))
(make-evaluator 'typed/racket #:requires '("utils.rkt"))))
@section{Base types}

View File

@ -1,16 +1,5 @@
#lang racket
#lang typed/racket
;;; dds/utils
;;; Various utilities.
(require
graph
(for-syntax syntax/parse racket/list))
;;; Typed section.
(module typed typed/racket
(require typed/graph typed/rackunit typed-compose typed/racket/stream
(for-syntax syntax/parse racket/list))
@ -569,18 +558,3 @@
(: variable-mapping? (-> Any Boolean : HashTableTop))
(define (variable-mapping? dict)
(hash? dict))
)
(require 'typed)
(provide eval-with eval1-with auto-hash-ref/explicit auto-hash-ref/:
extract-symbols any->string stringify-variable-mapping string->any
map-sexp read-org-sexp unorg unstringify-pairs
read-org-variable-mapping unorgv read-symbol-list drop-first-last
list-sets->list-strings pretty-print-set pretty-print-set-sets
update-vertices/unweighted update-graph dotit collect-by-key
collect-by-key/sets ht-values/list->set hash->list/ordered
multi-split-at lists-transpose in-random cartesian-product-2/stream
cartesian-product/stream boolean-power boolean-power/stream any->01
01->boolean
variable-mapping?)