> On Feb 4, 2017, at 8:18 AM, Sourav Datta <soura.ja...@gmail.com> wrote: > > (require/typed "grammar1.rkt" > [parse (->* (Listof Token) > (Any) > Syntax)]) > > Type Checker: Type (->* (Listof Token) (Any) Syntax) could not be converted > to a contract: required a flat contract but generated a chaperone contract > in: (->* (Listof Token) (Any) Syntax) > > I am not sure what this means exactly but is this because Racket does not see > the automatically exported function parse (or parse-tree) from a #lang brag > module? And, is there a way to correct this error so that I can call the > parse function from a TR module?
1) That type declaration for `parse` seems both too strict (in terms of the input `parse` will accept), and not quite accurate in terms of order of arguments. I might do it this way: (require/typed brag/support [#:opaque Token token-struct?] [token (->* ((U String Symbol)) (Any #:line Positive-Integer #:column Natural #:position Positive-Integer #:span Natural #:skip? Boolean) Token)]) (define-type Tok (U String Symbol Token Void)) (require/typed "grammar1.rkt" [parse (case-> ((U (Listof Tok) (-> Tok)) . -> . Any) (Any (U (Listof Tok) (-> Tok)) . -> . Any))]) 2) If I use `Any` rather than `Syntax` as the output type, then `parse` works. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.