Found source of bug with promises type: locally-defined recursive types can't be used (inferred) in other modules, see TR issue #262 https://github.com/racket/typed-racket/issues/262 .
This commit is contained in:
parent
191ae7f50e
commit
484a920b4e
46
graph/graph/__DEBUG_graph_1__.rkt
Normal file
46
graph/graph/__DEBUG_graph_1__.rkt
Normal file
|
@ -0,0 +1,46 @@
|
|||
#lang typed/racket
|
||||
|
||||
#|
|
||||
(module m typed/racket
|
||||
(define foo
|
||||
(let ()
|
||||
(define-type Foo (Pairof (Promise Foo) Number))
|
||||
|
||||
(define (f [n : Number]) : Foo
|
||||
(cons (delay (f (add1 n)))
|
||||
n))
|
||||
(f 1)))
|
||||
|
||||
(provide foo))
|
||||
|
||||
(require 'm)
|
||||
(force (car foo))
|
||||
|#
|
||||
|
||||
(define-type (P A) (Pairof (U A Null) (U A Null)))
|
||||
|
||||
(define bar
|
||||
(let ()
|
||||
(define-type Bar (Pairof (P Bar) Number))
|
||||
|
||||
(define (f [n : Number]) : Bar
|
||||
(cons (ann (cons '() '()) (P Bar))
|
||||
n))
|
||||
|
||||
(f 1)))
|
||||
|
||||
(provide P bar)
|
||||
|
||||
#|
|
||||
(define foo
|
||||
(let ()
|
||||
;(define-type Foo (Rec F (Pairof (Promise F) Number)))
|
||||
(define-type Foo (Pairof (Promise Foo) Number))
|
||||
|
||||
(define (f [n : Number]) : Foo
|
||||
(cons (delay (f (add1 n)))
|
||||
n))
|
||||
(f 1)))
|
||||
|
||||
(provide foo)
|
||||
|#
|
21
graph/graph/__DEBUG_graph_2__.rkt
Normal file
21
graph/graph/__DEBUG_graph_2__.rkt
Normal file
|
@ -0,0 +1,21 @@
|
|||
#lang typed/racket
|
||||
|
||||
(module m typed/racket
|
||||
(define-type (TFoo A B) (List 'foo (U (TFoo A B) (TBar A B) A)))
|
||||
(define-type (TBar A B) (List 'bar (U (TFoo A B) (TBar A B) B)))
|
||||
|
||||
(define foo
|
||||
(let ()
|
||||
(define-type Foo (TFoo One Zero))
|
||||
(define-type Bar (TBar One Zero))
|
||||
|
||||
(ann (list 'foo 1) Foo)))
|
||||
|
||||
(provide foo))
|
||||
|
||||
(require 'm)
|
||||
|
||||
(: f (∀ (A) (→ (List Symbol A) Any)))
|
||||
(define (f x) 2)
|
||||
|
||||
(f foo)
|
|
@ -1,9 +1,15 @@
|
|||
#lang typed/racket
|
||||
#lang debug typed/racket
|
||||
|
||||
(require (submod "graph3.lp2.rkt" test))
|
||||
(require racket/list)
|
||||
|
||||
(force (car (second g)))
|
||||
;(map force (second g))
|
||||
;#R(force (second g))
|
||||
|
||||
;(map force (third g))
|
||||
(ann g 1)
|
||||
|
||||
#|
|
||||
#R(force (caadr (force (car (second g)))))
|
||||
#R(map force (second g))
|
||||
|
||||
#R(map force (third g))
|
||||
|#
|
9
graph/graph/__DEBUG_graph_lift__.rkt
Normal file
9
graph/graph/__DEBUG_graph_lift__.rkt
Normal file
|
@ -0,0 +1,9 @@
|
|||
#lang typed/racket
|
||||
|
||||
(define-syntax (l stx)
|
||||
#`(let ()
|
||||
#,(syntax-local-lift-expression #'(begin (define-type Foo (List 'foo Foo Bar One)) (void)))
|
||||
#,(syntax-local-lift-expression #'(begin (define-type Bar (List 'foo Foo Bar One)) (void)))
|
||||
1))
|
||||
|
||||
(l)
|
|
@ -330,11 +330,10 @@ Then we define the @tc[node/make-placeholder] function:
|
|||
|
||||
@subsection{Making with-indices nodes}
|
||||
|
||||
We derive the @tc[with-indices] type from each @emph{ideal} node type using
|
||||
the @tc[tmpl-replace-in-type] template metafunction from the rewrite-type
|
||||
library. We replace all occurrences of a @tc[node] name with an @tc[Index],
|
||||
which indicates at which index in the queue's results the successor can be
|
||||
found.
|
||||
We derive the @tc[with-indices] type from each @emph{ideal} node type using the
|
||||
@tc[tmpl-replace-in-type] template metafunction from the rewrite-type library.
|
||||
We replace all occurrences of a @tc[node] name with an @tc[Index], which
|
||||
indicates at which index in the queue's results the successor can be found.
|
||||
|
||||
@; TODO: use a type-expander here, instead of a template metafunction.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user