
Although th eoriginal idea was to distinguish "text" paths from derived filesystem paths, practically everythign that accepts a module path also accepts a path. Building the generalization into `module-path?' makes it easier to support `submod' wrappers on paths, and it seems to fix things rather than break them.
36 lines
1.2 KiB
Racket
36 lines
1.2 KiB
Racket
#lang racket/base
|
|
|
|
(require racket/contract/base
|
|
"private/modcollapse-noctc.rkt")
|
|
|
|
(define simple-rel-to-module-path-v/c
|
|
(and/c module-path?
|
|
(or/c
|
|
path?
|
|
(cons/c 'lib any/c)
|
|
(cons/c 'file any/c)
|
|
(cons/c 'planet any/c)
|
|
(cons/c 'quote any/c)
|
|
(cons/c 'submod
|
|
(cons/c (or/c
|
|
path?
|
|
(cons/c 'lib any/c)
|
|
(cons/c 'file any/c)
|
|
(cons/c 'planet any/c)
|
|
(cons/c 'quote any/c))
|
|
(listof symbol?))))))
|
|
|
|
(define rel-to-module-path-v/c
|
|
(or/c simple-rel-to-module-path-v/c
|
|
path?
|
|
symbol? ;; why do we allow symbols (which are non-normalized) as a `relto' value?
|
|
(-> simple-rel-to-module-path-v/c)))
|
|
|
|
(provide/contract
|
|
[collapse-module-path (module-path?
|
|
rel-to-module-path-v/c
|
|
. -> . simple-rel-to-module-path-v/c)]
|
|
[collapse-module-path-index ((or/c symbol? module-path-index?)
|
|
rel-to-module-path-v/c
|
|
. -> . simple-rel-to-module-path-v/c)])
|