Removal of the extra case, shifts the bug. It now type checks fine, but when you instantiate (run) the module it blows up with a bountiful error message. <div><br></div><div>If I again comment out the kw args all is well. <br>
<div>To summarize: </div><div>1) case-> + kw => type checking fails.</div><div>2) Remove case, leave kws => RUNning the module fails.</div><div>3) Remove kws and add back case-> => everything works.</div><div>
<br></div><div>Ray</div><div><br></div><div><br></div><div><br></div><div><div>function: broke its contract</div><div> promised a procedure that accepts 3 arguments and arbitrarily more and the optional keywords #:alpha #:color #:label #:samples #:style #:width #:y-max #:y-min</div>
<div> produced: #<procedure:function></div><div> in: (recursive-contract</div><div>... for ~300 lines</div><div><br></div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On Fri, Aug 10, 2012 at 3:12 AM, Eric Dobson <span dir="ltr"><<a href="mailto:eric.n.dobson@gmail.com" target="_blank">eric.n.dobson@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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>
<div><div class="h5"><br>
<br>
<br>
On Thu, Aug 9, 2012 at 4:01 PM, Ray Racine <<a href="mailto:ray.racine@gmail.com">ray.racine@gmail.com</a>> wrote:<br>
> The following sample works well enough that I can do something similar for<br>
> each of my current situational plotting needs However, I can't seem to get<br>
> any of the keyword typings to work.<br>
><br>
> No keyword typing support for require/typed at this time, bug, or I'm flat<br>
> out doing it wrong?<br>
><br>
> Thanks,<br>
><br>
> Ray<br>
><br>
> #lang typed/racket/base<br>
><br>
> (require<br>
> (only-in racket/math<br>
> sqr))<br>
><br>
> (define-type Color% (Class () () ()))<br>
><br>
> (define-type Plot-Pen-Style (U Integer<br>
> (U 'transparent 'solid<br>
> 'bdiagnol-hatch 'fdiagonal-hatch<br>
> 'horizontal-hath 'veritcal-hatch<br>
> 'crossdisg-hatch 'cross-hath)))<br>
><br>
> (define-type Plot-Color (U Integer (List Real Real Real)<br>
> String Symbol Color%))<br>
><br>
> (define-type Image-Snip% (Class () () ()))<br>
><br>
> (require/typed plot/utils<br>
> [opaque Renderer2d renderer2d?]<br>
> [linear-seq (Real Real Exact-Nonnegative-Integer -> (Listof<br>
> Real))])<br>
><br>
> (require/typed plot/main<br>
> [plot (Any -> Any)]<br>
> [function (case-> ((Real -> Real)<br>
> (Option Exact-Rational)<br>
> (Option Exact-Rational)<br>
> ;[#:y-min Exact-Rational]<br>
> ; [#:y-max Exact-Rational]<br>
> ; [#:samples Integer]<br>
> ; [#:color Plot-Color]<br>
> ; [#:width Natural]<br>
> ; [#:style Plot-Pen-Style]<br>
> ; [#:alpha Real]<br>
> ; [#:label (Option String)]<br>
> -> Renderer2d)<br>
> ((Real -> Real) -> Renderer2d))]<br>
><br>
> [area-histogram<br>
> ((Real -> Real) (Listof Real) -> Renderer2d)])<br>
><br>
> (define (test)<br>
> (: f (Real -> Real))<br>
> (define (f x) (exp (* -1/2 (sqr x))))<br>
> (plot (list (area-histogram f (linear-seq -4 4 10))<br>
> (function f -4 4))))<br>
><br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</blockquote></div><br></div></div></div>