{-# LANGUAGE TemplateHaskell #-}
module Text.Collate.CanonicalCombiningClass
( canonicalCombiningClass )
where
import Text.Collate.UnicodeData (genCanonicalCombiningClassMap)
import qualified Data.IntMap as M
import Data.Maybe (fromMaybe)
combiningClassMap :: M.IntMap Int
combiningClassMap :: IntMap Int
combiningClassMap = $(genCanonicalCombiningClassMap)
canonicalCombiningClass :: Int -> Int
canonicalCombiningClass :: Int -> Int
canonicalCombiningClass Int
cp
| Int
cp forall a. Ord a => a -> a -> Bool
< Int
0x300 = Int
0
| Bool
otherwise = forall a. a -> Maybe a -> a
fromMaybe Int
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Int -> IntMap a -> Maybe a
M.lookup Int
cp forall a b. (a -> b) -> a -> b
$! IntMap Int
combiningClassMap