miscellanous haskell functions