It seems like syntax-parse is expanding into untyped code (which makes sense), 
and typed racket can’t type check it (which also makes sense).  And also, I 
can’t use require/typed to import the untyped stuff that syntax/parse uses 
because of lexical context and hygienic macros and all that (which also makes 
sense).

So is there a version of syntax/parse that expands into code that typed racket 
can use?

Or is there some kind of workaround?

Right now when I do something like this:
#lang typed/racket
(require syntax/parse)
(syntax-parse #'x
  [x #'x])
It gives me these errors:
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: ps-empty
  from module: syntax/parse/private/residual in: (syntax-parse (syntax x) (x 
(syntax x)))
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: syntax-patterns-fail
  from module: syntax/parse/private/residual in: (syntax-parse (syntax x) (x 
(syntax x)))
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: current-syntax-context
  from module: racket/syntax in: (syntax-parse (syntax x) (x (syntax x)))
. Type Checker: expected Parameter, but got Nothing in: (syntax-parse (syntax 
x) (x (syntax x)))

And when I do as 3 of the error messages suggest and use require/typed, it 
still gives me those same errors (which makes sense because of the lexical 
context and hygienic macros and all that).  
#lang typed/racket

(require syntax/parse)

(require/typed syntax/parse/private/residual
               [ps-empty Any]
               [syntax-patterns-fail Any])
(require/typed racket/syntax
               [current-syntax-context (Parameterof (U Syntax #f))])

(syntax-parse #'x
  [x #'x])


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to