Skip to content
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

Add TaskSeq.tryitem, item, tryLast, last, tryHead, head, tryPick, pick, tryFind, find, choose, filter, isEmpty and more for IAsyncEnumerable<'T> #23

Merged
merged 20 commits into from
Oct 14, 2022

Conversation

abelbraaksma
Copy link
Member

@abelbraaksma abelbraaksma commented Oct 13, 2022

First batch of the functions mentioned in #22, see title.

Implemented the following (WIP):

  • isEmpty
  • tryExacltyOne
  • exactlyOne
  • head
  • tryHead
  • last
  • tryLast
  • item
  • tryItem
  • filter
  • filterAsync
  • choose
  • chooseAsync
  • pick
  • pickAsync
  • tryPick
  • tryPickAsync
  • find
  • tryFind
  • findAsync
  • tryFindAsync

The signatures (WIP, will update) completed:

val tryHead: taskSeq: taskSeq<'T> -> Task<'T option>
val head: taskSeq: taskSeq<'T> -> Task<'T>

val tryLast: taskSeq: taskSeq<'T> -> Task<'T option>
val last: taskSeq: taskSeq<'T> -> Task<'T>  // may raise

val tryItem: index: int -> taskSeq: taskSeq<'T> -> Task<'T option>
val item: index: int -> taskSeq: taskSeq<'T> -> Task<'T>  // may raise

val tryExactlyOne: source: taskSeq<'T> -> Task<'T option>
val exactlyOne: source: taskSeq<'T> -> Task<'T>  // may raise

val choose: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> taskSeq<'U>
val chooseAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> taskSeq<'U>
val filter: predicate: ('T -> bool) -> source: taskSeq<'T> -> taskSeq<'T>
val filterAsync: predicate: ('T -> #Task<bool>) -> source: taskSeq<'T> -> taskSeq<'T>

val tryPick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U option>
val tryPickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U option>
val pick: chooser: ('T -> 'U option) -> source: taskSeq<'T> -> Task<'U>  // may raise
val pickAsync: chooser: ('T -> #Task<'U option>) -> source: taskSeq<'T> -> Task<'U>  // may raise

val tryFind: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T option>
val tryFindAsync: predicate: ('T -> #Task<bool>) -> source: taskSeq<'T> -> Task<'T option>
val find: predicate: ('T -> bool) -> source: taskSeq<'T> -> Task<'T>  // may raise
val findAsync: predicate: ('T -> #Task<bool>) -> source: taskSeq<'T> -> Task<'T>  // may raise

@abelbraaksma abelbraaksma changed the title Add TaskSeq.tryitem, item, tryLast, last, tryHead, head Add TaskSeq.tryitem, item, tryLast, last, tryHead, head, tryPick, pick, tryFind, find, choose, filter, isEmpty and more Oct 14, 2022
Revert "Troubleshooting CI, remove OfXXX, CE, Other and ToXXX"

This reverts commit 6856b9e.

Turn TaskSeq.empty into a unit-function

Troubleshooting CI, remove Item, Pick, CE

Revert "Troubleshooting CI, remove Item, Pick, CE"

This reverts commit bc6c260.

Several attempts at troubleshooting CI issue, see log details and #25

Temporarily killing most tests, to troubleshoot hanging CI

Revert "Temporarily killing most tests, to troubleshoot hanging CI"

This reverts commit b84fff1.

Troubleshooting CI, adding back several new tests

Temporarily killing most tests, to troubleshoot hanging CI

Revert "Temporarily killing most tests, to troubleshoot hanging CI"

This reverts commit b84fff1.

Troubleshooting CI, adding back several new tests

Revert "Troubleshooting CI, adding back several new tests"

This reverts commit 5ecf179.

Troubleshooting CI, re-enabling only some tests, including new perf tests

Revert "Troubleshooting CI, re-enabling only some tests, including new perf tests"

This reverts commit 602cb3a.

Troubleshooting CI, removing only the new perf tests

Revert "Troubleshooting CI, removing only the new perf tests"

This reverts commit d16f739.

Troubleshooting CI, up until Iter is included

Revert "Troubleshooting CI, up until Iter is included"

This reverts commit 7f63395.

Troubleshooting CI, up until Iter is removed (excluded)

This reverts commit 7f63395.

Revert "Troubleshooting CI, up until Iter is removed (excluded)"

This reverts commit 32d463b.

Troubleshooting CI, tests for Last, Map and Pick excluded

Revert "Troubleshooting CI, tests for Last, Map and Pick excluded"

This reverts commit 9132fee.

Troubleshooting CI: remove all tests but Choose tests

Troubleshooting CI, add hang timeout test

Revert "Troubleshooting CI: remove all tests but Choose tests"

This reverts commit 93cfda5.

Troubleshooting CI, removing deliberately hanging test, leave blame-detection in test.yaml

Troubleshooting hanging CI: order test cases (currently only within a class, not sure how to change it)

Troubleshooting CI, re-enable parallelization of tests and clean code
@abelbraaksma abelbraaksma force-pushed the add-tryitem-tryfind-etc branch from 8ddfbf9 to c2a0657 Compare October 14, 2022 19:55
@abelbraaksma
Copy link
Member Author

Important note: I have disabled parallel test runs due to a race condition that was hard to pin down. Dozens of commits and reverts have been squashed back into one, to keep a clean history.

See #25 for further investigation.

@abelbraaksma abelbraaksma changed the title Add TaskSeq.tryitem, item, tryLast, last, tryHead, head, tryPick, pick, tryFind, find, choose, filter, isEmpty and more Add TaskSeq.tryitem, item, tryLast, last, tryHead, head, tryPick, pick, tryFind, find, choose, filter, isEmpty and more for IAsyncEnumerable<'T> Oct 14, 2022
@abelbraaksma abelbraaksma merged commit 507b9e5 into main Oct 14, 2022
@abelbraaksma abelbraaksma deleted the add-tryitem-tryfind-etc branch October 14, 2022 20:00
@abelbraaksma abelbraaksma added the enhancement New feature or request label Oct 22, 2022
@abelbraaksma abelbraaksma added the topic: surface area Adds functions to the public surface area label Oct 22, 2022
@abelbraaksma abelbraaksma added this to the v0.1.0 milestone Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic: surface area Adds functions to the public surface area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant