title: Haskell get function run time
body: <p>How can i capture the runtime of a Haskell function, for example, a file Main.hs, compiled with GHC containing a function 'bubbleSort' which sorts items in a list:</p>
  
  <pre><code> bubbleSort :: (Ord t) =&gt; [t] -&gt; [t]
   bubbleSort a = loop (length a) bubble a 
  
   bubble :: (Ord t) =&gt; [t] -&gt; [t]
   bubble (a:b:c) | a &lt; b = a : bubble (b:c)
         | otherwise = b : bubble (a:c)
   bubble (a:[]) = [a] 
   bubble [] = []
  
   loop :: (Num a, Ord a) =&gt; a -&gt; (t -&gt; t) -&gt; t -&gt; t
   loop num f x | num &gt; 0 =  loop (num-1) f x'
       | otherwise = x
       where x' = f x 
  </code></pre>
  
  <p>Note: I am aware this is not the most effective sorting method. </p>