Re: [racket-users] Re: Type Racket command-line #:ps causing type error

2017-05-22 Thread kay
Cool thanks for the clarification Vincent!

On Monday, May 22, 2017 at 9:39:15 AM UTC-7, Vincent St-Amour wrote:
> Hi Kay,
> 
> On Sun, 21 May 2017 23:30:50 -0500,
> kay wrote:
> > 
> > Hi Vincent,
> > 
> > Thanks for fixing it. Is there a Github commit that you can refer me
> > to? Or does Racket development actually happen on Github?
> 
> Yes, Racket development does happen on github.
> 
> The relevant commit is this one:
> https://github.com/racket/typed-racket/commit/c0af5235d255ca1a9622249c0ca26ad5349ccefa
> 
> > In addition, MORE IMPORTANTLY, now that it looks like a bug that I
> > found, is there a workaround to this problem without waiting for a new
> > release that contains the fix?
> 
> I see two potential solutions here:
> - You could use a nightly build (from pre.racket-lang.org) instead of a
>   released version, until 6.10 comes out (planned for July).
> - You could use `require/typed` to import `parse-command-line` at the
>   type that you need. That's the procedure version of the `command-line`
>   syntax, which should support all the same options, but with a
>   different interface. Since it's a procedure, you can ascribe it a type
>   yourself.
> 
> > How stable is Typed Racket? I know you guys are doing an awesome job
> > and I really love it - but just trying to put my expectation right, as
> > I'm totally new to TR and this is my first TR problem and I
> > encountered this bug, leading me to wonder this question.
> 
> I'll let Sam answer this one, or one of TR's users. :)
> 
> In general, though, it's possible for TR to lag a bit behind untyped
> Racket for some things. If a Racket function, say, gains an extra
> keyword argument, we're usually pretty good at adding it to its type
> quickly. Sometimes things fall through the cracks; #:ps must have been
> one of them.
> 
> Vincent
> 
> 
> 
> > On Thursday, May 18, 2017 at 1:51:14 PM UTC-7, Vincent St-Amour wrote:
> > > I just pushed a fix. Thanks for the report!
> > > 
> > > Vincent
> > > 
> > > 
> > > On Wed, 17 May 2017 01:47:11 -0500,
> > > lu wrote:
> > > > 
> > > > On Tuesday, May 16, 2017 at 12:47:37 AM UTC-7, kay wrote:
> > > > > Hi I feel this might be a bug, can anyone confirm or suggest a fix?
> > > > > 
> > > > > Here's a minimal usage of `command-line` form:
> > > > > 
> > > > > ```
> > > > > #lang typed/racket
> > > > > 
> > > > > (define *message* : (Parameterof (Listof String)) (make-parameter 
> > > > > '()))
> > > > > (define *verbose* : (Parameterof Boolean) (make-parameter #f))
> > > > > 
> > > > > (define (parse-cmdline)
> > > > > (command-line
> > > > >  #:program "q"
> > > > >  #:once-each
> > > > >  [("-v" "--verbose") "verbose mode" (*verbose* #t)]
> > > > >  #:ps "foo bar" ; < causing type error
> > > > >  #:args #{msg : String} (*message* msg)))
> > > > > 
> > > > > (parse-cmdline)
> > > > > ```
> > > > > 
> > > > > Note that it gives the below type error[1]. However, if you comment 
> > > > > out the line with #:ps, type check passes.
> > > > > 
> > > > > I noticed that from the error prompt, for argument 3, the expected 
> > > > > Union type doesn't include 'ps. This leads me to think it might be a 
> > > > > bug. Please tell me it's not and there's a fix:)
> > > > > 
> > > > > 
> > > > > [1]: type error:
> > > > > 
> > > > > test.rkt:6:0: Type Checker: Polymorphic function `parse-command-line' 
> > > > > could not be applied to arguments:
> > > > > Argument 1:
> > > > >   Expected: Path-String
> > > > >   Given:String
> > > > > Argument 2:
> > > > >   Expected: (U (Listof String) (Vectorof String))
> > > > >   Given:(Vectorof String)
> > > > > Argument 3:
> > > > >   Expected: (Listof (Pairof (U 'final 'help-labels 'multi 'once-any 
> > > > > 'once-each) (Listof (Listof Any
> > > > >   Given:(List (List 'once-each (List (List String String) (-> Any 
> > > > > Void) (Listof (List String (List 'ps String))
> > > > > Argument 4:
> > > > >   Expected: (-> Any a ... a b)
> > > > >   Given:(-> Any String * Void)
> > > > > Argument 5:
> > > > >   Expected: (Listof String)
> > > > >   Given:(List String)
> > > > > 
> > > > >   in: (define (parse-cmdline) (command-line #:program "q" #:once-each 
> > > > > (("-v" "--verbose") "verbose mode" (*verbose* #t)) #:ps "foo bar" 
> > > > > #:args msg (*message* msg)))
> > > > 
> > > > Ping... can anyone help with this problem?
> > > > 
> > > > -- 
> > > > 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.

-- 
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 

Re: [racket-users] Re: Type Racket command-line #:ps causing type error

2017-05-22 Thread Vincent St-Amour
Hi Kay,

On Sun, 21 May 2017 23:30:50 -0500,
kay wrote:
> 
> Hi Vincent,
> 
> Thanks for fixing it. Is there a Github commit that you can refer me
> to? Or does Racket development actually happen on Github?

Yes, Racket development does happen on github.

The relevant commit is this one:
https://github.com/racket/typed-racket/commit/c0af5235d255ca1a9622249c0ca26ad5349ccefa

> In addition, MORE IMPORTANTLY, now that it looks like a bug that I
> found, is there a workaround to this problem without waiting for a new
> release that contains the fix?

I see two potential solutions here:
- You could use a nightly build (from pre.racket-lang.org) instead of a
  released version, until 6.10 comes out (planned for July).
- You could use `require/typed` to import `parse-command-line` at the
  type that you need. That's the procedure version of the `command-line`
  syntax, which should support all the same options, but with a
  different interface. Since it's a procedure, you can ascribe it a type
  yourself.

> How stable is Typed Racket? I know you guys are doing an awesome job
> and I really love it - but just trying to put my expectation right, as
> I'm totally new to TR and this is my first TR problem and I
> encountered this bug, leading me to wonder this question.

I'll let Sam answer this one, or one of TR's users. :)

In general, though, it's possible for TR to lag a bit behind untyped
Racket for some things. If a Racket function, say, gains an extra
keyword argument, we're usually pretty good at adding it to its type
quickly. Sometimes things fall through the cracks; #:ps must have been
one of them.

Vincent



> On Thursday, May 18, 2017 at 1:51:14 PM UTC-7, Vincent St-Amour wrote:
> > I just pushed a fix. Thanks for the report!
> > 
> > Vincent
> > 
> > 
> > On Wed, 17 May 2017 01:47:11 -0500,
> > lu wrote:
> > > 
> > > On Tuesday, May 16, 2017 at 12:47:37 AM UTC-7, kay wrote:
> > > > Hi I feel this might be a bug, can anyone confirm or suggest a fix?
> > > > 
> > > > Here's a minimal usage of `command-line` form:
> > > > 
> > > > ```
> > > > #lang typed/racket
> > > > 
> > > > (define *message* : (Parameterof (Listof String)) (make-parameter '()))
> > > > (define *verbose* : (Parameterof Boolean) (make-parameter #f))
> > > > 
> > > > (define (parse-cmdline)
> > > > (command-line
> > > >  #:program "q"
> > > >  #:once-each
> > > >  [("-v" "--verbose") "verbose mode" (*verbose* #t)]
> > > >  #:ps "foo bar" ; < causing type error
> > > >  #:args #{msg : String} (*message* msg)))
> > > > 
> > > > (parse-cmdline)
> > > > ```
> > > > 
> > > > Note that it gives the below type error[1]. However, if you comment out 
> > > > the line with #:ps, type check passes.
> > > > 
> > > > I noticed that from the error prompt, for argument 3, the expected 
> > > > Union type doesn't include 'ps. This leads me to think it might be a 
> > > > bug. Please tell me it's not and there's a fix:)
> > > > 
> > > > 
> > > > [1]: type error:
> > > > 
> > > > test.rkt:6:0: Type Checker: Polymorphic function `parse-command-line' 
> > > > could not be applied to arguments:
> > > > Argument 1:
> > > >   Expected: Path-String
> > > >   Given:String
> > > > Argument 2:
> > > >   Expected: (U (Listof String) (Vectorof String))
> > > >   Given:(Vectorof String)
> > > > Argument 3:
> > > >   Expected: (Listof (Pairof (U 'final 'help-labels 'multi 'once-any 
> > > > 'once-each) (Listof (Listof Any
> > > >   Given:(List (List 'once-each (List (List String String) (-> Any 
> > > > Void) (Listof (List String (List 'ps String))
> > > > Argument 4:
> > > >   Expected: (-> Any a ... a b)
> > > >   Given:(-> Any String * Void)
> > > > Argument 5:
> > > >   Expected: (Listof String)
> > > >   Given:(List String)
> > > > 
> > > >   in: (define (parse-cmdline) (command-line #:program "q" #:once-each 
> > > > (("-v" "--verbose") "verbose mode" (*verbose* #t)) #:ps "foo bar" 
> > > > #:args msg (*message* msg)))
> > > 
> > > Ping... can anyone help with this problem?
> > > 
> > > -- 
> > > 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.

-- 
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.


Re: [racket-users] Re: Type Racket command-line #:ps causing type error

2017-05-21 Thread kay
Hi Vincent,

Thanks for fixing it. Is there a Github commit that you can refer me to? Or 
does Racket development actually happen on Github?

In addition, MORE IMPORTANTLY, now that it looks like a bug that I found, is 
there a workaround to this problem without waiting for a new release that 
contains the fix?

How stable is Typed Racket? I know you guys are doing an awesome job and I 
really love it - but just trying to put my expectation right, as I'm totally 
new to TR and this is my first TR problem and I encountered this bug, leading 
me to wonder this question. 


Thanks,
Kefei



On Thursday, May 18, 2017 at 1:51:14 PM UTC-7, Vincent St-Amour wrote:
> I just pushed a fix. Thanks for the report!
> 
> Vincent
> 
> 
> On Wed, 17 May 2017 01:47:11 -0500,
> lu wrote:
> > 
> > On Tuesday, May 16, 2017 at 12:47:37 AM UTC-7, kay wrote:
> > > Hi I feel this might be a bug, can anyone confirm or suggest a fix?
> > > 
> > > Here's a minimal usage of `command-line` form:
> > > 
> > > ```
> > > #lang typed/racket
> > > 
> > > (define *message* : (Parameterof (Listof String)) (make-parameter '()))
> > > (define *verbose* : (Parameterof Boolean) (make-parameter #f))
> > > 
> > > (define (parse-cmdline)
> > > (command-line
> > >  #:program "q"
> > >  #:once-each
> > >  [("-v" "--verbose") "verbose mode" (*verbose* #t)]
> > >  #:ps "foo bar" ; < causing type error
> > >  #:args #{msg : String} (*message* msg)))
> > > 
> > > (parse-cmdline)
> > > ```
> > > 
> > > Note that it gives the below type error[1]. However, if you comment out 
> > > the line with #:ps, type check passes.
> > > 
> > > I noticed that from the error prompt, for argument 3, the expected Union 
> > > type doesn't include 'ps. This leads me to think it might be a bug. 
> > > Please tell me it's not and there's a fix:)
> > > 
> > > 
> > > [1]: type error:
> > > 
> > > test.rkt:6:0: Type Checker: Polymorphic function `parse-command-line' 
> > > could not be applied to arguments:
> > > Argument 1:
> > >   Expected: Path-String
> > >   Given:String
> > > Argument 2:
> > >   Expected: (U (Listof String) (Vectorof String))
> > >   Given:(Vectorof String)
> > > Argument 3:
> > >   Expected: (Listof (Pairof (U 'final 'help-labels 'multi 'once-any 
> > > 'once-each) (Listof (Listof Any
> > >   Given:(List (List 'once-each (List (List String String) (-> Any 
> > > Void) (Listof (List String (List 'ps String))
> > > Argument 4:
> > >   Expected: (-> Any a ... a b)
> > >   Given:(-> Any String * Void)
> > > Argument 5:
> > >   Expected: (Listof String)
> > >   Given:(List String)
> > > 
> > >   in: (define (parse-cmdline) (command-line #:program "q" #:once-each 
> > > (("-v" "--verbose") "verbose mode" (*verbose* #t)) #:ps "foo bar" #:args 
> > > msg (*message* msg)))
> > 
> > Ping... can anyone help with this problem?
> > 
> > -- 
> > 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.

-- 
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.


Re: [racket-users] Re: Type Racket command-line #:ps causing type error

2017-05-18 Thread Vincent St-Amour
I just pushed a fix. Thanks for the report!

Vincent


On Wed, 17 May 2017 01:47:11 -0500,
lu wrote:
> 
> On Tuesday, May 16, 2017 at 12:47:37 AM UTC-7, kay wrote:
> > Hi I feel this might be a bug, can anyone confirm or suggest a fix?
> > 
> > Here's a minimal usage of `command-line` form:
> > 
> > ```
> > #lang typed/racket
> > 
> > (define *message* : (Parameterof (Listof String)) (make-parameter '()))
> > (define *verbose* : (Parameterof Boolean) (make-parameter #f))
> > 
> > (define (parse-cmdline)
> > (command-line
> >  #:program "q"
> >  #:once-each
> >  [("-v" "--verbose") "verbose mode" (*verbose* #t)]
> >  #:ps "foo bar" ; < causing type error
> >  #:args #{msg : String} (*message* msg)))
> > 
> > (parse-cmdline)
> > ```
> > 
> > Note that it gives the below type error[1]. However, if you comment out the 
> > line with #:ps, type check passes.
> > 
> > I noticed that from the error prompt, for argument 3, the expected Union 
> > type doesn't include 'ps. This leads me to think it might be a bug. Please 
> > tell me it's not and there's a fix:)
> > 
> > 
> > [1]: type error:
> > 
> > test.rkt:6:0: Type Checker: Polymorphic function `parse-command-line' could 
> > not be applied to arguments:
> > Argument 1:
> >   Expected: Path-String
> >   Given:String
> > Argument 2:
> >   Expected: (U (Listof String) (Vectorof String))
> >   Given:(Vectorof String)
> > Argument 3:
> >   Expected: (Listof (Pairof (U 'final 'help-labels 'multi 'once-any 
> > 'once-each) (Listof (Listof Any
> >   Given:(List (List 'once-each (List (List String String) (-> Any Void) 
> > (Listof (List String (List 'ps String))
> > Argument 4:
> >   Expected: (-> Any a ... a b)
> >   Given:(-> Any String * Void)
> > Argument 5:
> >   Expected: (Listof String)
> >   Given:(List String)
> > 
> >   in: (define (parse-cmdline) (command-line #:program "q" #:once-each 
> > (("-v" "--verbose") "verbose mode" (*verbose* #t)) #:ps "foo bar" #:args 
> > msg (*message* msg)))
> 
> Ping... can anyone help with this problem?
> 
> -- 
> 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.

-- 
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.