title: Haskell recursive sort function
body: <p>I would like to implement a sort function in Haskell with these two functions:</p>
  
  <pre><code>smallest :: (Ord a) =&gt; [a] -&gt; a
  smallest [] = error "empty list"
  smallest [x] = x
  smallest (x:xs)
    | x &lt; smallest xs = x
    | otherwise = smallest xs
  
  insert :: Int -&gt; [Int] -&gt; [Int]
  insert x [] = [x]
  insert x (y:ys)
    | x &lt;= y = x:y:ys
    | otherwise = y:insert x ys
  </code></pre>
  
  <p>My idea is to insert the smallest value at the right position with a recursion but as I am new to Haskell I got some problems on how to implement that.</p>