[racket] struct contract violation problem
On Oct 23, 2013, at 6:25 PM, Erik Pearson <erik at adaptations.com> wrote:
> 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.
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
Here is an interaction in a Racket built today:
> (url-port (string->url "http://www.ccs.neu.edu/"))
#f
Can you confirm this much? Can you add more context.