Show Instance for CodePoints#93
Conversation
src/Data/String/CodePoints.purs
Outdated
| derive instance ordCodePoint :: Ord CodePoint | ||
|
|
||
| instance showCodePoint :: Show CodePoint where | ||
| show cp = "(CodePoint " <> show (singleton cp) <> ")" |
There was a problem hiding this comment.
This instance should definitely exist, but I think it would be better to print the contained Int in hex format. Do you know if that's possible now, or will we need to add a dependency?
There was a problem hiding this comment.
https://pursuit.purescript.org/packages/purescript-integers/3.2.0/docs/Data.Int#v:toStringAs would do the trick. I think, there is an advantage of displaying the Unicode representation. Maybe a combined version?
(CodePoint 0x... - "∆"). That way you can see if you have chosen the correct number for the symbol you wanted.
There was a problem hiding this comment.
I think it would be best to just use the Int, to keep it simple, and to avoid suggesting that there's anything more to a CodePoint than just an Int. People can use singleton if they want to see the code point as a string.
|
Great, thanks! There's just a few things I'd like to be done before merging:
|
|
Thank you! |
this is useful for creating examples for the documentation