Some list processing utility functions in Haskell