Frequncy counting in Haskell