amuletml / amulet

An ML-like functional programming language
https://amulet.works/
BSD 3-Clause "New" or "Revised" License
328 stars 16 forks source link

Add a show instance for string. #243

Closed davidgarland closed 4 years ago

davidgarland commented 4 years ago

Sorry about the issue submitted and quickly closed a little earlier-- I was thinking under the assumption that a show instance for string already existed.

plt-amy commented 4 years ago

This instance won't properly escape control characters. Moreover, why do you want to convert a string to a string?

davidgarland commented 4 years ago

I want to be able to print structures that contain strings-- I'm obviously not interested in using show on a string directly.

As for the control characters bit-- good point, I guess it needs some more attention to detail than that. Perhaps I can take another stab at this when it's not about time for me to get some sleep.

davidgarland commented 4 years ago

I'll close this for now-- there's some more that needs to be added in terms of utility functions (character type predicates like is_digit for instance) before writing the code to do proper escaping would be elegant. In addition this doesn't seem like a large priority, so best to not keep it open indefinitely.