On 5/9/20, Hendrik Boom <hend...@topoi.pooq.com> 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

The code you have looks like this to Typed Racket:

(for/set : TYPE
  (((val0 val1 val2) (in-lines input-port)))

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.
To view this discussion on the web visit 

Reply via email to