Refactored `trim` function to get rid of some duplication

<pre> 
  trim = f . f
    where f = reverse . dropWhile isSpace
</pre> 
<b> looks better than </b> 
<pre> 
trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace 
</pre>