countOccurences

1
2
3
4
5
6
7
8
9
10
11
import Data.Map

{-| Count character occurences in a string

    Examples:
    >>> lookup 'l' $ countOccurences "hello"
    Just 2
    >>> lookup 'n' $ countOccurences "hello"
    Nothing
-}
countOccurences :: [Stirng] -> Map Char Int