Skip to content
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

Default instance for Display #104

Open
reactormonk opened this issue Jun 3, 2018 · 3 comments
Open

Default instance for Display #104

reactormonk opened this issue Jun 3, 2018 · 3 comments

Comments

@reactormonk
Copy link

Would be really convenient to have a default implementation for Display, so deriving (Display) is possible.

@snoyberg
Copy link
Collaborator

snoyberg commented Jun 3, 2018

What sensible default could we have? The only thing I can think of is using Show, but it's not a good option because:

  1. It goes via String, which defeats the high-performance goals of this typeclass
  2. A Display instance is intended to be human readable, whereas a Show instance is intended to match up with Haskell syntax

@reactormonk
Copy link
Author

  1. Could be solved by reimplementing the Show logic with Text.
  2. Couldn't there be a default on how to display a record of values? It doesn't have to obey any laws anymore, so how it'll look like is arbitrary.

@snoyberg
Copy link
Collaborator

snoyberg commented Jun 3, 2018

It sounds like you're talking about creating a Generic-based implementation using the Utf8Builder type which takes a random stab at making something user-friendly. I'm not sure about that approach tbh, I think it's going to end up encouraging the creation of non-user-friendly instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants