-
Notifications
You must be signed in to change notification settings - Fork 19
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
be able to print any type #165
Comments
Yeah this would be fantastic to have. Conceptually it seems straightforward for the compiler to provide a polymorphic primitive Generating pretty printers automatically for arbitrary types seems like it could be a pain! Perhaps we could start with simple things (e.g. just base types, integers, tuples, etc.) and extend it incrementally with support for more interesting stuff. |
would it be feasible to extend the compiler with an "anytime" expression that gets passed through the various stages of the compilation? if so, then this and similar things could be easy to implement perhaps? |
Yeah, MLton/MPL essentially already have these! MLton calls them "primitive" operations. Primitives can pass through all compilation stages if needed, and different primitives are eliminated (i.e., implemented) by different passes. |
maybe we need a |
Yup! That's what I was imagining above. The primitive can then be eliminated (elaborated into real code) at any point after the monomorphization pass. |
cool! |
it is a pain to have to write print functions
i have encountered a good example (simplifying here to make the point)
i was writing a function
now i am testing with
'a = int
but if i try to printx
insidef
, then i break polymorphism because i am assuming int :(so basically i have to change my type signature etc...
The text was updated successfully, but these errors were encountered: