[plt-scheme] Typed Scheme: Is there any easy way around this?
On 5/30/07, Matthew Swank <akopa.gmane.poster at gmail.com> wrote:
> (pdefine: (a b) (mappend (fun : (a -> (Listof b))) (lst : (Listof a))) : (Listof b)
> ;;Append the results of calling fn on each element of list.
> (apply append (map fun lst)))
>
> --> typecheck: polymorphic functions not supported with apply
Try this:
(pdefine: (a b) (mappend (fun : (a -> (Listof b))) (lst : (Listof a)))
: (Listof b)
;;Append the results of calling fn on each element of list.
(apply #{append :: ((Listof b) .. -> (Listof b))} (map fun lst)))
Basically, we explicitly instantiate append at the type b.
Hope that helps, and thanks for trying Typed Scheme!
--
sam th
samth at ccs.neu.edu