Skip to content

feat: add Set/Map/MutMap without Order#80

Draft
JonathanStarup wants to merge 12 commits into
masterfrom
hashcollections
Draft

feat: add Set/Map/MutMap without Order#80
JonathanStarup wants to merge 12 commits into
masterfrom
hashcollections

Conversation

@JonathanStarup
Copy link
Copy Markdown
Collaborator

This might be a bit random, but here it is. Completely untested...

I should copy the std lib tests...

Copy link
Copy Markdown
Owner

@mlutze mlutze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very much in favor of this being a testing ground for all the things we haven't yet convinced Magnus of. :D

Comment thread src/Core.flix Outdated
Comment thread src/Utils/HashMap.flix
use HashSet.HashSet

/// invariants:
/// <<A>> There are no mappings with empty lists
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we express these as laws?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe laws are public and we need private ones?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any law usage in ex. List. How would you use it here (like syntax and everything, I've never used it :P).

Also, isn't laws on Magnus' chopping block?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the first one you can take care of by using a Nel instead of a list.

For B you can do something like this I think:

law noDuplicates: forall(h: HashMap[k, v]) . // some boolean expression that says that all the lists have no duplicates

Alternatively you could introduce a ListSet type which itself would have that law.

@JonathanStarup JonathanStarup marked this pull request as draft September 24, 2022 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants