-
Notifications
You must be signed in to change notification settings - Fork 90
add Show class and friends #1641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c24a9f6 to
f49d557
Compare
6051c9c to
f0e9147
Compare
f0e9147 to
a7922df
Compare
a7922df to
42490b4
Compare
42490b4 to
a7cc249
Compare
YarinHeffes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great 👍
| (inline) | ||
| (declare proxy-function-from (Proxy (:a -> :b) -> Proxy :a)) | ||
| (define (proxy-function-from _) | ||
| "Get a `Proxy` representing the \"domain\" of a function type." | ||
| Proxy) | ||
|
|
||
| (inline) | ||
| (declare proxy-function-to (Proxy (:a -> :b) -> Proxy :b)) | ||
| (define (proxy-function-to _) | ||
| "Get a `Proxy` representing the \"codomain\" of a function type." | ||
| Proxy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your opinion on using the following instead?
| (inline) | |
| (declare proxy-function-from (Proxy (:a -> :b) -> Proxy :a)) | |
| (define (proxy-function-from _) | |
| "Get a `Proxy` representing the \"domain\" of a function type." | |
| Proxy) | |
| (inline) | |
| (declare proxy-function-to (Proxy (:a -> :b) -> Proxy :b)) | |
| (define (proxy-function-to _) | |
| "Get a `Proxy` representing the \"codomain\" of a function type." | |
| Proxy) | |
| (inline) | |
| (declare proxy-left (Proxy (:T :a :b) -> Proxy :a)) | |
| (define (proxy-left _) | |
| "Get a `Proxy` representing the \"domain\" of a relational type." | |
| Proxy) | |
| (inline) | |
| (declare proxy-right (Proxy (:T :a :b) -> Proxy :b)) | |
| (define (proxy-right _) | |
| "Get a `Proxy` representing the \"codomain\" of a relational type." | |
| Proxy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that because it doesn't make sense for types like Result or Either, but I think (?) that'll typecheck. What about proxy-function-arg and proxy-function-result? from/to also seem fine.
This is to scratch an itch of being able to print stuff, superseding
traceand friends. It introduces two type classes:ShowType :twithshow-type-toto reify a string representation of:tShow :twithshow-toto reify a string representation of values of:tfor debugging purposesBoth use a "callback-style" interface: provide an
f :: (String -> Unit)to these procedures, andfwill be called on the component strings. One can always build an actual, full string withshow-as-stringandshow-inferred-type-as-string.Other cool things:
TODO:
ShowTypeandShowfor the rest of the library types.Future work: