[racket] struct contract violation problem

From: Erik Pearson (erik at adaptations.com)
Date: Wed Oct 23 18:25:00 EDT 2013

Excuse my poor experience with contracts, this is probably an easy one.

I'm using a copy of net/url and have a strange problem. The copied library
is working fine in general, but this problem cropped up today:

struct:exn:fail:contract:blame url-port: contract violation
expected: url?
given: #<url>
in: the 1st argument of
(-> url? (or/c #f number?))
contract from:
/home/epearson/work/racket/github/adaptnet/url-structs.rkt
blaming: /home/epearson/work/racket/github/racqueb/httpc.rkt
at: /home/epearson/work/racket/github/adaptnet/url-structs.rkt:4.28

The error is thrown in my usage of url-port which is being passed a
perfectly good url struct object. The file is requiring the copied
url-structs. If I play with the function that is being blamed in httpc.rkt
via the repl in dr racket, this specific error is not thrown. The call to
(url-port url) succeeds without throwing this contract exception.

>From my primitive understanding, I'm flummoxed: Why is a #<url> not a url?

I suspected that there may have been a leftover require of net/url
confusing things, but I can't find any in my code.

Using racket head from github 5.90.0.9--2013-10-20(d6610289/d)

Help!

Thanks,
Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131023/8f6e7093/attachment.html>

Posted on the users mailing list.