[plt-scheme] TS-Guide example 3.2 type checking error

From: Mark Millikan (markmillikan at gmail.com)
Date: Fri Nov 27 12:44:16 EST 2009

All of the examples in the ts-guide type check and run correctly for me
except the Typed Scheme version of example 3.2 (the last code example on the
page).

This happens with DrScheme 4.2.2 and the svn snapshot of 4.2.3.2 captured
below. To this first time user the error message is not immediately more
useful than some of those haskell can dispense.

Any help with <1> what the error is trying to say? , <2> should the example
work?

--------------------------------------------------------------------------------------

Contents of definition window copied from
http://docs.plt-scheme.org/ts-guide/index.html example 3.2
(Same error with re-keyed example)

#lang typed-scheme
  (: map
     (All (C A B ...)
          ((A B ... B -> C) (Listof A) (Listof B) ... B
           ->
           (Listof C))))
  (define (map f as . bss)
    (if (or (null? as)
            (ormap null? bss))
        null
        (cons (apply f (car as) (map car bss))
              (apply map f (cdr as) (map cdr bss)))))

----------------------------------------------------------------------------------------------
Contents of interaction window after <running> the above definition:

Welcome to DrScheme, version 4.2.3.2-svn26nov2009 [3m].
Language: Module; memory limit: 128 megabytes.
. typecheck: Polymorphic function map could not be applied to arguments:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (All (a b) (case-lambda ((Pair a b) -> a) ((Listof a) -> a)))
(Listof (Listof Any))
 in: (#%app map car bss)
. typecheck: Bad arguments to function in apply:
Domain: A B ... B
Arguments: A (U) *
 in: (#%app apply f (#%app car as) (#%app map car bss))
. typecheck: Polymorphic function map could not be applied to arguments:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (All (a b) (case-lambda ((Pair a b) -> b) ((Listof a) -> (Listof
a)))) (Listof (Listof Any))
 in: (#%app map cdr bss)
. typecheck: Bad arguments to polymorphic function in apply:
Domain: (A B ... B -> C) (Listof A) (Listof B) ... B
Arguments: (A B ... B -> C) (Listof A) (U) *
 in: (#%app apply map f (#%app cdr as) (#%app map cdr bss))
. typecheck: Summary: 4 errors encountered in:
  (#%app map car bss)
  (#%app apply f (#%app car as) (#%app map car bss))
  (#%app map cdr bss)
  (#%app apply map f (#%app cdr as) (#%app map cdr bss))
>

Thanks,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091127/08146829/attachment.html>

Posted on the users mailing list.