- |Array of soundex codes for single characters.  The
--  array maps uppercase letters (only) to a character
--  representing a code in the range ['1'..'7'] or '?'.  Code
--  '7' is returned as a coding convenience for
--  American/Miracode/NARA/Knuth soundex.

soundexCodes :: Array Char Char
soundexCodes = accumArray updater '?' ('A', 'Z') codes where
    updater '?' c = c
    updater _ c = error ("updater called twice on " ++ [c])
    groups = [('1', "BFPV"),
              ('2', "CGJKQSXZ"),
              ('3', "DT"),
              ('4', "L"),
              ('5', "MN"),
              ('6', "R"),
              ('7', "HW")]   
    codes = concatMap make_codes groups
    make_codes (i, s) = zip s (repeat i)


-- | Utility function: id except for point substitution.

soundexCodes :: Array Char Char
soundexCodes = accumArray updater '?' ('A', 'Z') codes where
    updater '?' c = c
    updater _ c = error ("updater called twice on " ++ [c])
    groups = [('1', "BFPV"),
              ('2', "CGJKQSXZ"),
              ('3', "DT"),
              ('4', "L"),
              ('5', "MN"),
              ('6', "R"),
              ('7', "HW")]   
    codes = concatMap make_codes groups
    make_codes (i, s) = zip s (repeat i)


-- | Utility function: id except for point substitution.
soundexCodes = accumArray updater '?' ('A', 'Z') codes where
    updater '?' c = c
    updater _ c = error ("updater called twice on " ++ [c])
    groups = [('1', "BFPV"),
              ('2', "CGJKQSXZ"),
              ('3', "DT"),
              ('4', "L"),
              ('5', "MN"),
              ('6', "R"),
              ('7', "HW")]   
    codes = concatMap make_codes groups
    make_codes (i, s) = zip s (repeat i)


-- | Utility function: id except for point substitution.