From 093b26acdade0f68ceb8d0de2cd134d2087406f2 Mon Sep 17 00:00:00 2001 From: Leif Warner Date: Wed, 2 Aug 2023 14:43:49 -0700 Subject: [PATCH] Specify impl for `Show[Symbol]` On 2.12, `Symbol.toString` is e.g. `'foo`. On 2.13, it's `Symbol(foo)`. I want to use `Show` to get away from the vagaries of relying on `.toString` - to have a reliable nailed-down String representation for types. Want to use `Show` to build a pretty-printer, without having the output depend on which Scala version you're using. I tried overriding the `Show[Symbol]` instance locally, but I just got an ambiguous implicit error. Don't know how to not import this instance, since it's on the companion object for `Show`. --- core/src/main/scala/cats/instances/SymbolInstances.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/cats/instances/SymbolInstances.scala b/core/src/main/scala/cats/instances/SymbolInstances.scala index 843e1228ae..62039e4e9b 100644 --- a/core/src/main/scala/cats/instances/SymbolInstances.scala +++ b/core/src/main/scala/cats/instances/SymbolInstances.scala @@ -25,5 +25,5 @@ import cats.Show trait SymbolInstances extends cats.kernel.instances.SymbolInstances { implicit val catsStdShowForSymbol: Show[Symbol] = - Show.fromToString[Symbol] + Show.show("'" + _.name) }