-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you please expose internal module? #4
Comments
Do you already have a mechanism for normalizing your UTF-8 encoded texts into NFD form? That is a required step of the algorithm. If so, I can expose something like normalizedCodePointsToSortKey :: Collation -> VariableWeighting -> [Int] -> SortKey
normalizedCodePointsToSortKey collation weighting =
mkSortKey opts
. handleVariable weighting
. getCollationElements collation But if you don't have the normalization piece yet, this won't do any good. unicode-transforms is limited to Text. Note: I've requested that unicode-transforms expose an interface for incremental normalization: |
Yes, it’s already there |
Would the signature noted above be the right kind of thing for you to use? |
Let me know if this commit gives you what you need. |
Thanks, it definitely works. |
My latest version gives you something a bit different, but hopefully still workable: -- | Compare two strings of any type that can be unpacked
-- lazily into a list of 'Char's.
, collateWithUnpacker :: forall a. Eq a => (a -> [Char]) -> a -> a -> Ordering |
Also note that in the latest version (0.1.3), you |
Yes, I see, that's a better API indeed. |
As the author of Z-Data, we'd like to add support to unicode-collation, but our
Text
type use UTF-8 encoding, which is different totext
's one. So could you please add API for creating sort keys from[Int]
directly? I assumed this can be done via exposing some internal modules.The text was updated successfully, but these errors were encountered: