diff options
author | Joris | 2017-11-08 23:47:26 +0100 |
---|---|---|
committer | Joris | 2017-11-08 23:47:26 +0100 |
commit | 27e11b20b06f2f2dbfb56c0998a63169b4b8abc4 (patch) | |
tree | 845f54d7fe876c9a3078036975ba85ec21d224a1 /common/src/Common/Util | |
parent | a3601b5e6f5a3e41fa31752a2c704ccd3632790e (diff) |
Use a better project structure
Diffstat (limited to 'common/src/Common/Util')
-rw-r--r-- | common/src/Common/Util/Text.hs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/common/src/Common/Util/Text.hs b/common/src/Common/Util/Text.hs new file mode 100644 index 0000000..4af7a4c --- /dev/null +++ b/common/src/Common/Util/Text.hs @@ -0,0 +1,41 @@ +module Common.Util.Text + ( unaccent + ) where + +import Data.Text (Text) +import qualified Data.Text as T + +unaccent :: Text -> Text +unaccent = T.map unaccentChar + +unaccentChar :: Char -> Char +unaccentChar c = case c of + 'à' -> 'a' + 'á' -> 'a' + 'â' -> 'a' + 'ã' -> 'a' + 'ä' -> 'a' + 'ç' -> 'c' + 'è' -> 'e' + 'é' -> 'e' + 'ê' -> 'e' + 'ë' -> 'e' + 'ì' -> 'i' + 'í' -> 'i' + 'î' -> 'i' + 'ï' -> 'i' + 'ñ' -> 'n' + 'ò' -> 'o' + 'ó' -> 'o' + 'ô' -> 'o' + 'õ' -> 'o' + 'ö' -> 'o' + 'š' -> 's' + 'ù' -> 'u' + 'ú' -> 'u' + 'û' -> 'u' + 'ü' -> 'u' + 'ý' -> 'y' + 'ÿ' -> 'y' + 'ž' -> 'z' + _ -> c |