title: how to display a list
body: <p>Here is my code:</p>
  
  <pre><code>sumOfSquare :: Int -&gt; Int -&gt; Int
  sumOfSquare a b = a * a + b * b
  
  hipotenuse :: Int -&gt; Int -&gt; Int
  hipotenuse a b = truncate(sqrt(x))
             where x = fromIntegral(sumOfSquare a b)
  
  squareCheck :: Int -&gt; Bool
  squareCheck n = truncate(sqrt(x)) * truncate(sqrt(x)) == n
           where x = fromIntegral n
  
  isItSquare :: Int -&gt; Int -&gt; Bool
  isItSquare a b = squareCheck (sumOfSquare a b)
  
  data SidesType = Sides Int Int Int deriving (Show)
  
  calc :: Int -&gt; [SidesType]
  calc a = [(Sides x y (hipotenuse x y)) | x &lt;- [1..a], y &lt;-[1..a], (isItSquare x y)]
  
  test :: Int -&gt; SidesType
  test a = (Sides 1 2 3)
  </code></pre>
  
  <p>I need to display result of calc.  It doesn't work:</p>
  
  <pre><code>*Main&gt; calc
  &lt;interactive&gt;:1:0:
      No instance for (Show (Int -&gt; [SidesType]))
        arising from a use of `print' at &lt;interactive&gt;:1:0-3
      Possible fix:
        add an instance declaration for (Show (Int -&gt; [SidesType]))
      In a stmt of an interactive GHCi command: print it
  </code></pre>
  
  <p>Call of test works correcly:</p>
  
  <pre><code>*Main&gt; test 1
  Sides 1 2 3
  </code></pre>
  
  <p>As I understanded the reason is the calc function return the list of SidesType and Haskell can display a SidesType, but cannot display the list of SidesType.</p>
  
  <p>Do I need to change my SidesType description? Or do I need to fix error somehow else?</p>
  
  <p>And another one question - can I display the result of calc function without defining new datatype:</p>
  
  <pre><code>calc :: Int -&gt; (Int, Int, Int)
  calc a = [x y (hipotenuse x y) | x &lt;- [1..a], y &lt;-[1..a], (isItSquare x y)]
  </code></pre>
  
  <p>?</p>