title: Haskell: Deriving Show for custom type
body: <p>I have this type definition:</p>
  
  <pre><code>data Operace = Op (Int-&gt;Int-&gt;Int) String (Int-&gt;Int-&gt;Int) deriving Show
  </code></pre>
  
  <p>I want to print this type into the interactive shell (GHCi). All that should be printed is the <code>String</code> field.</p>
  
  <p>I tried this:</p>
  
  <pre><code>instance Show Operace where
      show (Op op str inv) = show str
  </code></pre>
  
  <p>But I still keep getting</p>
  
  <pre><code>No instance for (Show (Int -&gt; Int -&gt; Int))
    arising from the 'deriving' clause of a data type declaration
  Possible fix:
    add an instance declaration for (Show (Int -&gt; Int -&gt; Int))
    or use a standalone 'deriving instance' declaration,
         so you can specify the instance context yourself
  When deriving the instance for (Show Operace)
  </code></pre>
  
  <p>I don't want to add <code>Show</code> for <code>(Int-&gt;Int-&gt;Int)</code>, all I want to print is the string.</p>
  
  <p>Thanks for help!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>For future reference, the fixed version is:</p>
  
  <pre><code>data Operace = Op (Int-&gt;Int-&gt;Int) String (Int-&gt;Int-&gt;Int)
  
  instance Show Operace where
      show (Op _ str _) = str
  </code></pre>