title: Haskell - What does the type Ord a mean?
body: <p>I'm creating a merge sort function in Haskell that is recursive. I have been told as part of my assessment that I must define the type as:</p>
  
  <pre><code>isort :: Ord a =&gt; [a] -&gt; [a]
  </code></pre>
  
  <p>I assumed the function expects an array as input and outputs an array. I know that <code>ord</code> is a class. </p>
  
  <p>In the context above what does the <code>Ord a</code> mean?</p>
  
  <p>This is my function:</p>
  
  <pre><code>isort :: Ord a =&gt; [a] -&gt; [a]
  isort [x] = [x]
  isort (x:xs) = insert x (isort xs)
      where
          insert :: Int -&gt; [Int] -&gt; [Int]
          insert a [] = []
          insert a (b:c) | a &lt; b      = a:b:c
                         | otherwise  = b : insert a c
  </code></pre>
  
  <p>When I try to load my functions file into ghci I get the error:</p>
  
  <pre><code>Couldn't match type ‘a’ with ‘Int’
    ‘a’ is a rigid type variable bound by
        the type signature for isort :: Ord a =&gt; [a] -&gt; [a]
        at LabSheet2.hs:17:10
  Expected type: [a]
  Actual type: [Int]
  ...
  </code></pre>