-
-
Notifications
You must be signed in to change notification settings - Fork 102
Automated Resyntax fixes #1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Automated Resyntax fixes #1450
Changes from all commits
ca5aec0
0669cd7
88e0afd
c9b5c87
007f69f
5dcdb5f
2bf9a68
91f5d90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,12 +45,15 @@ | |
(arr-seq-sc-map f (combinator-args v)) | ||
(void)) | ||
(define (sc->contract v f) | ||
(match v | ||
[(arr-combinator (arr-seq args rest range)) | ||
(with-syntax ([(arg-stx ...) (map f args)] | ||
[(rest-stx ...) (if rest #`(#:rest #,(f rest)) #'())] | ||
[range-stx (if range #`(values #,@(map f range)) #'any)]) | ||
#'(arg-stx ... rest-stx ... . -> . range-stx))])) | ||
(match-define (arr-combinator (arr-seq args rest range)) v) | ||
(with-syntax ([(arg-stx ...) (map f args)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should resyntax use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @jackfirth There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've considered it. The opportunity doesn't seem to come up much though. |
||
[(rest-stx ...) (if rest | ||
#`(#:rest #,(f rest)) | ||
#'())] | ||
[range-stx (if range | ||
#`(values #,@(map f range)) | ||
#'any)]) | ||
#'(arg-stx ... rest-stx ... . -> . range-stx))) | ||
(define (sc->constraints v f) | ||
(merge-restricts* 'chaperone (map f (arr-seq->list (combinator-args v)))))]) | ||
|
||
|
@@ -66,20 +69,18 @@ | |
|
||
|
||
(define (arr-seq-sc-map f seq) | ||
(match seq | ||
[(arr-seq args rest range) | ||
(arr-seq | ||
(map (λ (a) (f a 'contravariant)) args) | ||
(and rest (f rest 'contravariant)) | ||
(and range (map (λ (a) (f a 'covariant)) range)))])) | ||
(match-define (arr-seq args rest range) seq) | ||
(arr-seq (map (λ (a) (f a 'contravariant)) args) | ||
(and rest (f rest 'contravariant)) | ||
(and range (map (λ (a) (f a 'covariant)) range)))) | ||
|
||
(define (arr-seq->list seq) | ||
(match seq | ||
[(arr-seq args rest range) | ||
(append | ||
args | ||
(if rest (list rest) empty) | ||
(or range empty))])) | ||
(match-define (arr-seq args rest range) seq) | ||
(append args | ||
(if rest | ||
(list rest) | ||
empty) | ||
(or range empty))) | ||
|
||
|
||
(struct arr-seq (args rest range) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,12 @@ | |
(pt-seq-map f (combinator-args v)) | ||
(void)) | ||
(define (sc->contract v f) | ||
(match v | ||
[(prompt-tag-combinator (pt-seq vals call-cc)) | ||
(with-syntax ([(vals-stx ...) (map f vals)] | ||
[(call-cc-stx ...) | ||
(if call-cc | ||
#`(#:call/cc (values #,@(map f call-cc))) | ||
empty)]) | ||
#'(prompt-tag/c vals-stx ... call-cc-stx ...))])) | ||
(match-define (prompt-tag-combinator (pt-seq vals call-cc)) v) | ||
(with-syntax ([(vals-stx ...) (map f vals)] | ||
[(call-cc-stx ...) (if call-cc | ||
#`(#:call/cc (values #,@(map f call-cc))) | ||
empty)]) | ||
#'(prompt-tag/c vals-stx ... call-cc-stx ...))) | ||
(define (sc->constraints v f) | ||
(merge-restricts* 'chaperone (map f (pt-seq->list (combinator-args v)))))]) | ||
|
||
|
@@ -52,16 +50,11 @@ | |
|
||
|
||
(define (pt-seq-map f seq) | ||
(match seq | ||
[(pt-seq vals call-cc) | ||
(define (f* a) (f a 'invariant)) | ||
(pt-seq | ||
(map f* vals) | ||
(and call-cc (map f* call-cc)))])) | ||
(match-define (pt-seq vals call-cc) seq) | ||
(define (f* a) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really want a way to turn this formatting decision off. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function in particular hardly seems worth defining at all. |
||
(f a 'invariant)) | ||
(pt-seq (map f* vals) (and call-cc (map f* call-cc)))) | ||
|
||
(define (pt-seq->list seq) | ||
(match seq | ||
[(pt-seq vals call-cc) | ||
(append | ||
vals | ||
(or call-cc empty))])) | ||
(match-define (pt-seq vals call-cc) seq) | ||
(append vals (or call-cc empty))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another
for/reverse