[racket-dev] TRPlot - A Typed Racket-ing of Plot

From: Ray Racine (ray.racine at gmail.com)
Date: Sun Aug 12 20:58:16 EDT 2012

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:

On Fri, Aug 10, 2012 at 3:12 AM, Eric Dobson <eric.n.dobson at gmail.com>
wrote:
> It looks like there is an issue with turning case lambdas with
> keywords into a contract. If you drop the one argument case for
> function, it should work.

Sam: "Unfortunately, the `case->` contract combinator that Typed Racket
relies on doesn't support keyword arguments, so it's very difficult to
generate an appropriate contract here."

On Sun, Aug 12, 2012 at 8:35 PM, Neil Toronto <neil.toronto at gmail.com>wrote:

> On 08/12/2012 06:14 PM, Ray Racine wrote:
>
>> Just completed a first cut draft TRing the Plot collection.  Completely
>> untested, though the few things I've tried worked fine.
>> Neil/Sam, any suggestions, naming or layout conventions are much
>> appreciated.  Otherwise, I'll do a cleanup pass, test it, and initiate a
>> pull-request this week.
>>
>> https://github.com/RayRacine/**racket/tree/tr-plot/collects/**typed/plot<https://github.com/RayRacine/racket/tree/tr-plot/collects/typed/plot>
>>
>
> Cool!
>
> 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
>
> [surface3d ((Real Real -> Real)
>             (Option Exact-Rational)
>             (Option Exact-Rational)
>             (Option Exact-Rational)
>             (Option Exact-Rational)
>             .... -> Renderer3d)]
>
> where `....' represents the keyword argument types. To account for the
> possible argument combinations, it should be
>
> [surface3d
>  (case-> ((Real Real -> Real)
>           .... -> Renderer3d)
>          ((Real Real -> Real)
>           (Option Exact-Rational)
>           .... -> Renderer3d)
>          ((Real Real -> Real)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           .... -> Renderer3d)
>          ((Real Real -> Real)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           .... -> Renderer3d)
>          ((Real Real -> Real)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           (Option Exact-Rational)
>           .... -> Renderer3d))]
>
> I agree with you that this is insane, and that Sam or Vincent should do
> something about it. :D
>
> 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.
>
> Neil ⊥
>
> _________________________
>  Racket Developers list:
>  http://lists.racket-lang.org/**dev <http://lists.racket-lang.org/dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120812/556eb3f8/attachment.html>

Posted on the dev mailing list.