[racket] Typed Racket: Command-line parsing problems

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sun Jun 23 20:34:08 EDT 2013

On Sun, Jun 23, 2013 at 2:21 PM, Tim K. <tk at crono.co.uk> wrote:
> Hello!
> I am using Typed Racket (version 5.2.1) and I'm porting an existing Racket
> program over to it. It's working well, except for a few minor things like
> "assoc" exclusively accepting lists of pairs and not lists of lists, which I
> found very odd (nothing a "filter" couldn't solve, though).

Can you say more about the problem here?  The type of `assoc` mentions
pairs, but you should be able to use it with lists, since they're made
of pairs.

> After porting nearly everything I was left with typing up the command-line
> parser. However, I am getting a type error at the following simplified part:

Here's a version that type checks: https://gist.github.com/samth/5847063

The key is giving a type annotation to `fname` using the #{} syntax.
Typed Racket can figure out how to typecheck the expansion only if you
give it that hint.  And the #{} syntax is for adding such hints with
macros like `command-line` that didn't anticipate Typed Racket.


Posted on the users mailing list.