You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a map's keys are Floats, Doubles, or some other type with an unreasonable Ord instance (not saying "unlawful" because Ord has no laws ☹️), then the guarantees provided by justified-containers don't hold. Example:
importPreludehiding (lookup)
importData.Map.JustifiedimportqualifiedData.MapasMtest_table::M.MapFloatString
test_table =M.fromList [ (0, "foo"), (-1, "bar"), (0/0, "oops"), (-5, "baz"), (-6, "qux"), (-3, "quux") ]
main::IO()
main = withMap test_table $\table ->docase member 0 table ofNothing->putStrLn"Sorry, I couldn't prove that the key is present."Just key ->doputStrLn ("Found key: "++show key)
putStrLn ("Value for key: "++lookup key table)
inserting (0/0) "whoops" table $\(newKey, upgrade, table') ->doputStrLn ("Value for key in updated map: "++lookup (upgrade key) table')
Found key: Key 0.0
Value for key: foo
Value for key in updated map: Main.hs: Data.Map.Justified has been subverted!
CallStack (from HasCallStack):
error, called at src/Data/Map/Justified.hs:402:17 in justified-containers-0.3.0.0-QwQWf1ossWJ9BbDcxnzmi:Data.Map.Justified
There's obviously nothing justified-containers can really do about this, so I'd just like it to be mentioned in the documentation.
The text was updated successfully, but these errors were encountered:
gdp package has Lawful constraint wrapper intended to mark "correct" instances. Of course, Double and Float aren't supposed to be Lawful Eq, and, therefore, Lawful Ord. But this is additional overhead, so...
If a map's keys are☹️ ), then the guarantees provided by justified-containers don't hold. Example:
Float
s,Double
s, or some other type with an unreasonableOrd
instance (not saying "unlawful" becauseOrd
has no lawsThere's obviously nothing justified-containers can really do about this, so I'd just like it to be mentioned in the documentation.
The text was updated successfully, but these errors were encountered: