Neil, I think this is a current limitation in TR. Can not case-> (i.e. spec optional args) along with KW args. From a previous email chain:<br><div><br></div><div><div class="im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
On Fri, Aug 10, 2012 at 3:12 AM, Eric Dobson <<a href="mailto:eric.n.dobson@gmail.com" style="color:rgb(17,85,204)">eric.n.dobson@gmail.com</a>> wrote:<br></div><div class="im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
> It looks like there is an issue with turning case lambdas with<br>> keywords into a contract. If you drop the one argument case for<br>> function, it should work.<br><br></div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Sam: "Unfortunately, the `case->` contract combinator that Typed Racket</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">relies on doesn't support keyword arguments, so it's very difficult to</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">generate an appropriate contract here."</span><br><br><div class="gmail_quote">On Sun, Aug 12, 2012 at 8:35 PM, Neil Toronto <span dir="ltr"><<a href="mailto:neil.toronto@gmail.com" target="_blank">neil.toronto@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 08/12/2012 06:14 PM, Ray Racine wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just completed a first cut draft TRing the Plot collection. Completely<br>
untested, though the few things I've tried worked fine.<br>
Neil/Sam, any suggestions, naming or layout conventions are much<br>
appreciated. Otherwise, I'll do a cleanup pass, test it, and initiate a<br>
pull-request this week.<br>
<br>
<a href="https://github.com/RayRacine/racket/tree/tr-plot/collects/typed/plot" target="_blank">https://github.com/RayRacine/<u></u>racket/tree/tr-plot/collects/<u></u>typed/plot</a><br>
</blockquote>
<br></div></div>
Cool!<br>
<br>
This is probably going to annoy you, but the `Option' type doesn't mean the argument isn't required. The entry for `surface3d' is currently<br>
<br>
[surface3d ((Real Real -> Real)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
.... -> Renderer3d)]<br>
<br>
where `....' represents the keyword argument types. To account for the possible argument combinations, it should be<br>
<br>
[surface3d<br>
(case-> ((Real Real -> Real)<br>
.... -> Renderer3d)<br>
((Real Real -> Real)<br>
(Option Exact-Rational)<br>
.... -> Renderer3d)<br>
((Real Real -> Real)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
.... -> Renderer3d)<br>
((Real Real -> Real)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
.... -> Renderer3d)<br>
((Real Real -> Real)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
(Option Exact-Rational)<br>
.... -> Renderer3d))]<br>
<br>
I agree with you that this is insane, and that Sam or Vincent should do something about it. :D<br>
<br>
In the meantime, write a new macro to use instead of `require/typed/provide'. (Macros inside types won't expand.) Fortunately, function types with keyword arguments already expand to `case->' types, so you don't have to change anything about those.<br>
<br>
Neil ⊥<br>
<br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/<u></u>dev</a><br>
</blockquote></div><br></div>