The first thing I notice is that opt-max-size is a (Parameterof Any), but you use string->number on it. So you should probably put a guard on the opt-max-size parameter something like this: (: opt-max-size (Parameterof Any Real)) (: opt-max-size-guard (Any -> Real)) (define (opt-max-size-guard val) (cond [(real? val) val] [(string? val) (opt-max-size-guard (string->number val))] [else (error "Max size: must be a real number")]))
(define opt-max-size (make-parameter 0 opt-max-size-guard)) On Jun 21, 2014, at 3:45 AM, Manfred Lotz <manfred.l...@arcor.de> wrote: > Hi there, > I try to change one of my programs to typed racket and fail because of > errors when dealing with command line arguments. > > Here a minimum example: > > #lang typed/racket/base > > (require racket/cmdline) > > > (: opt-verbose-mode (Parameterof Boolean)) > (define opt-verbose-mode (make-parameter #f)) > (: opt-max-size (Parameterof Any)) > (define opt-max-size (make-parameter "0")) > > > > (define parms > (command-line > #:program "mypgm" > #:once-each > [("-v" "--verbose") "Show verbose output" (opt-verbose-mode #t)] > [("-m" "--max-size") NUM ("Max size." "NUM") (opt-max-size NUM) ] > )) > > > (define (myfun) > (when (opt-verbose-mode) > (if (> (string->number (opt-max-size)) 0) > #t > #f))) > > > What do I do wrong? Any hint appreciated. > > -- > Thanks, > Manfred > > > > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users