Re: [racket-users] How to type annotate for bindings in complex syntax forms

2017-03-09 Thread Vincent St-Amour
On Mon, 06 Mar 2017 23:50:38 -0600, lu wrote: > > Awesome. Thanks! Where can I find the documentation for this TR reader syntax? > > Why is TR not able to figure out the type for these variables without > human help? Does that mean the implementation of `command-line` is in > TR and the types of

Re: [racket-users] How to type annotate for bindings in complex syntax forms

2017-03-06 Thread lu
Ah I found documentation for `#{ x : ... }` at here[1]. [1]: https://docs.racket-lang.org/ts-guide/more.html#%28part._.Annotating_.Single_.Variables%29 On Monday, March 6, 2017 at 9:50:39 PM UTC-8, lu wrote: > Awesome. Thanks! Where can I find the documentation for this TR reader syntax? > >

Re: [racket-users] How to type annotate for bindings in complex syntax forms

2017-03-06 Thread lu
Awesome. Thanks! Where can I find the documentation for this TR reader syntax? Why is TR not able to figure out the type for these variables without human help? Does that mean the implementation of `command-line` is in TR and the types of those variables are inferred by the type system, or they

Re: [racket-users] How to type annotate for bindings in complex syntax forms

2017-03-06 Thread Sam Tobin-Hochstadt
You can use the #{x : T} reader syntax to annotate variables in macros like `command-line`. Here's a working version of your code: ``` #lang typed/racket (define *channel* (make-parameter "#general")) (define *message* : (Parameterof (Listof String)) (make-parameter '())) (define

Re: [racket-users] How to type annotate for bindings in complex syntax forms

2017-03-06 Thread WarGrey Gyoudmon Ju
1.5 years ago, I struggled with the command-line, finally I thought `parse-command-line` is friendlier than its macro form `command-line`, and got the solution with `cast`: ;;; firstly, define your precise Help-Table. (define-type Help-Table (Listof (U (Pairof 'usage-help String)

[racket-users] How to type annotate for bindings in complex syntax forms

2017-03-05 Thread kay
For a complex syntax form like `command-line`, I have difficulty correctly annotate the bindings it defines. More specifically, in the below code, for variable `msg`, even the document[1] says the `#:args` binds as list of **strings**, but the error indicates that it somehow is declared as