Implement Show typeclass
See original GitHub issueThe goal is to automatically provide a better toString for case classes with field names.
Example :
case class Person(name: String, age: Int)
implicit personShow = ... // calling macro here
val p = Person("bob", 40)
Show.show(p) // returns "Person(name = bob, age = 40)"
//or
// import implicit class
p.show // returns "Person(name = bob, age = 40)"
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Chapter 6. Using Typeclasses - Real World Haskell
An instance type of this typeclass is any type that implements the ... It returns a String representing that data. ghci reports the...
Read more >Show - Typelevel
Show. Show. Show is an alternative to the Java toString method. It is defined by a single function show : def show(a: A):...
Read more >Haskell Show type class in a function - Stack Overflow
When I want to print the output of this function in ghci, Haskell seems to be confused as to which instance of Show...
Read more >Introduction to Haskell Typeclasses - Serokell
A type has an instance of a typeclass if it implements the methods of that typeclass. We can define these instances by hand,...
Read more >Text.Show - Hackage - Haskell.org
The shows functions return a function that prepends the output String to an existing String . This allows constant-time concatenation of results using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To use the macro from external project, I think user must add
addCompilerPlugin("org.scalameta" % "paradise" % "3.0.0-M10" cross CrossVersion.full)
to build.sbt, then external projet can call ShowMacroRemaining tasks for a first version of Show (using show branch) :