Skip to content

Instantly share code, notes, and snippets.

@gvolpe
Created October 5, 2021 19:09
Show Gist options
  • Save gvolpe/eb85cb0a2632e9ec179ce3bd80a73cee to your computer and use it in GitHub Desktop.
Save gvolpe/eb85cb0a2632e9ec179ce3bd80a73cee to your computer and use it in GitHub Desktop.

Revisions

  1. gvolpe revised this gist Oct 5, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion better-to-show.scala
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,4 @@ final case class User(name: String, age: Int) derives Show

    object Demo:
    @main def run =
    println(User("Joe", 18).show)
    println(User("Joe", 18).show) // outputs: User(name=Joe, age=18)
  2. gvolpe created this gist Oct 5, 2021.
    9 changes: 9 additions & 0 deletions better-to-show.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    import cats.Show
    import cats.derived.semiauto.*
    import cats.syntax.all.*

    final case class User(name: String, age: Int) derives Show

    object Demo:
    @main def run =
    println(User("Joe", 18).show)