[plt-scheme] puzzling bug with (extremely simple) curried Typed Scheme program

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Oct 20 01:58:28 EDT 2008

On Oct 20, Benjamin L.Russell wrote:
> #lang typed-scheme
> (: good-luck-curried (String -> Void))
> (define (good-luck-curried name)
>   (if (string=? name "Nobody")
>       (printf "You are ~a." name)
>       (good-luck-helper-curried name "Good Luck")))

You're missing an extra set of parens in the above.

> (: good-luck-helper-curried (String (String -> Void)))

And here you're missing an arrow:

  (: good-luck-helper-curried (String -> (String -> Void)))

(There is a real problem here: typed-scheme does not complain early
enough about your badly formed type, so the error is confusing.  It
should have said something about not being able to apply the `String'

> (define ((good-luck-helper-curried a) b)
>   (printf "~a, ~a!" a b))

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.