title: Can you "partially" derive a Typeclass?
body: <p>In the following toy example we create a new type <code>D</code> for which we want to implement the typeclass <code>Show</code>. Now let's say for all constructors the derived <code>show</code> function would be just fine, except for one special case <code>A</code> for which we want to override that default.</p>
  <p>Is it possible to do that, or can you just have <em>all</em> or <em>none</em> of them derived?</p>
  
  <pre class="lang-hs prettyprint-override"><code>data D = A | B | C
    deriving (Show)
  
  -- goal: 
  -- show A = &quot;A is special&quot;
  -- show B = &quot;B&quot;
  -- show C = &quot;C&quot;
  
  main = print $ show A
  </code></pre>
  <p><a href="https://tio.run/##y0gszk7Nyfn/PyWxJFHBRcFWwVGhRsEJiJ25FBRSUosyyzLz0hU0gjPyyzW5uHR1FdLzE3OsFECsYqAYULmtgpKjQmaxQnFBanJmYo4SXMoJJOWE4DuD@M5KXFy5iZl5QHZBUWZeiYIK1Jz//wE" rel="noreferrer" title="Haskell – Try It Online">Try it online!</a></p>