On Sat, May 09, 2020 at 12:24:16PM -0400, Ben Greenman wrote:
> On 5/9/20, Hendrik Boom <[email protected]> wrote:
> > I get the message
> >
> > readspec.rkt:195:8: Type Checker: Expression should produce 3 values, but
> > produces 1 values of types String in: (for/set : (Setof String) (((l :
> > String) (cast (in-lines input-port) (Sequenceof String)))) (cast
> > (string-trim l) String))
> >
> > from the following function:
> >
> > (define (read-manpages [input-port : Input-Port])
> >   (cast (for/set : (Setof String) (([l : String] (cast (in-lines input-port)
> > (Sequenceof String))))
> >            (cast (string-trim l) String))
> >     (Setof String)))
> >
> > The expression it is complaining about is the (for/list ......)
> > construction.
> >
> > I'm trying to covert a Racket program to a typed Racket program.
> > As far as I can see, this function reads words, one to a line, from
> > input-port and makes a set of these words.
> >
> > It baffles me where the type checker gets the idea that 3 values are wanted
> >
> > anywhere.
> >
> > I put in a lot of casts just to make sure I knew what types it had to work
> > with.
> >
> > The original code, without types:
> >
> > (define (read-manpages input-port)
> >   (for/set ((l (in-lines input-port)))
> >            (string-trim l)))
> >
> > Any ideas?
> 
> Well this is unfortunate.
> 
> `(l : String)` should be `l : String` with no parentheses

Got it. It's confusing whenyuo need the parentheses around a type-binding and 
when you don't. 

-- hendrik

> 
> The code you have looks like this to Typed Racket:
> 
> ```
> (for/set : TYPE
>   (((val0 val1 val2) (in-lines input-port)))
>   LOOP-BODY)
> ```
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAFUu9R7wBS_hbZpXmFR097qxi8F-54rkogEXe6R0Nyqp_iMqDQ%40mail.gmail.com.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200509181040.iwzvd4un2btgcf4w%40topoi.pooq.com.

Reply via email to