Add Show class - #3098
Conversation
|
#569 added Although, I'm not strongly opinionated to either direction. |
JacquesCarette
left a comment
There was a problem hiding this comment.
Comments on just the code.
| module Text.Show where | ||
|
|
||
| -- should builtin be used? | ||
| open import Agda.Builtin.Reflection using (Precedence) |
There was a problem hiding this comment.
You should avoid directly using builtins. Normally there is something in the library that re-exports it. There's a whole Reflection sub-library, it is likely there?
There was a problem hiding this comment.
It doesn't re-export Precedence from what I can tell (using rgrep)
|
Re: macros for deriving instances. 1) very good thing to offer. 2) likely we won't use them internally, as they do evil things to the dependency graph. Also, one thing Haskell got "wrong" was that |
As in what is IMO doing the |
|
Re: |
|
Definitely not an expert, at least from my end! Other than |
MatthewDaggitt
left a comment
There was a problem hiding this comment.
I'm happy with the names Show, Pretty, Read, Write
|
|
||
| instance | ||
| ListShow : {{ Show A }} → Show (List A) | ||
| ListShow .showsPrecList prec [] str = '[' ∷ (']' ∷ str) |
There was a problem hiding this comment.
We should probably define a surround and a concatenate in the library if we don't already have those and define this in terms of them?
Should hopefully resolve #569 and partially address #431.
Opening as a draft to start discussion on design. Points to look into:
ParseorReadclass that does the inverse