make ->string work with URLs

pull/3/head
Matthew Butterick 10 years ago
parent aea6c90b57
commit 2d542e890d

@ -42,7 +42,7 @@
(check-equal? (->string (void)) "") (check-equal? (->string (void)) "")
(check-equal? (->string 'foo) "foo") (check-equal? (->string 'foo) "foo")
(check-equal? (->string 123) "123") (check-equal? (->string 123) "123")
;(check-equal? (->string (string->url "foo/bar.html")) "foo/bar.html") (check-equal? (->string (string->url "foo/bar.html")) "foo/bar.html")
(define file-name-as-text "foo.txt") (define file-name-as-text "foo.txt")
(check-equal? (->string (string->path file-name-as-text)) file-name-as-text) (check-equal? (->string (string->path file-name-as-text)) file-name-as-text)
(check-equal? (->string #\¶) "") (check-equal? (->string #\¶) "")

@ -23,7 +23,7 @@
(provide Stringish) (provide Stringish)
(define-type Stringish (U String Symbol Number Path Char Null Void)) (define-type Stringish (U String Symbol Number Path Char Null Void SugarURL))
(define/typed+provide (->string x) (define/typed+provide (->string x)
@ -37,6 +37,7 @@
[(number? x) (number->string x)] [(number? x) (number->string x)]
[(path? x) (path->string x)] [(path? x) (path->string x)]
[(char? x) (format "~a" x)] [(char? x) (format "~a" x)]
[(url? x) (url->string x)]
[else (error 'bad-type)])))) [else (error 'bad-type)]))))

Loading…
Cancel
Save