-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
localeCompare can return different output depending on locale. Example borrowed from MDN:
console.log("ä".localeCompare("z", "de")); // a negative value: in German, ä sorts before z
console.log("ä".localeCompare("z", "sv")); // a positive value: in Swedish, ä sorts after zThe FFI for Data.String.Common.localeCompare uses the system default locale, so Data.String.Common.localeCompare "ä" "z" could be LT or GT depending on if it's run in Germany or Sweden, for example.
It seems unlikely (maybe even impossible? I'm not sure) for a system's locale to change over the lifetime of a program, so maybe that is enough to consider localeCompare observationally pure?
I'm mostly just curious about the intuition for what makes FFI code "effect"-ful, as I have a library of bindings for the Intl object and I was planning on adding to it a localeCompare that accepted the Locale argument as well.
Metadata
Metadata
Assignees
Labels
No labels