Skip to content

Consistent parameter ordering of linear collections#242

Merged
utdemir merged 5 commits intomasterfrom
ud/parameter-order-of-linear-collections
Oct 2, 2020
Merged

Consistent parameter ordering of linear collections#242
utdemir merged 5 commits intomasterfrom
ud/parameter-order-of-linear-collections

Conversation

@utdemir
Copy link
Copy Markdown
Contributor

@utdemir utdemir commented Oct 1, 2020

Closes #147 .

This PR updates the mutable collections API slightly to have consistency on order of parameters. The issue #147 has more reasoning behind the changes, but in short:

  • The pure-looking names take the collection as the last parameter (set, get, lookup)
  • Imperative-looking names take the collection as the first parameter (read, write)

For arrays and vectors, we both set and get methods alongside with the flipped versions as read and write (and their unsafe variants). However, unlifted arrays, maps and sets only have an entirely pure-looking interface. The only reason is that I did not find much value duplicating the entire API and making up new names for imperative-looking counterparts.

Let me know if you have another preference.

@utdemir utdemir requested a review from Divesh-Otwani October 1, 2020 03:41
utdemir and others added 2 commits October 1, 2020 16:45
If anything, `alterF` is part of the optics story (it's a lens in the
style of #197). But it's also generally useful, if rarely so.

Also exposes `alter` (which has been mysteriously forgotten) and
`alterF` in the export list.
Co-authored-by: Arnaud Spiwack <arnaud.spiwack@tweag.io>
@utdemir utdemir merged commit 04ed280 into master Oct 2, 2020
@utdemir utdemir deleted the ud/parameter-order-of-linear-collections branch October 2, 2020 09:31
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.

Parameter order of linear collections

2 participants