Some useful Haskell functions