Closed anovstrup closed 4 years ago
@anovstrup I left a comment here about how you can assign license and authorship to these: https://github.com/unisonweb/base/issues/15#issuecomment-606361945 LMK if you have any trouble.
@pchiusano Done. I ran into https://github.com/unisonweb/unison/issues/1364 when first adding the license/authorship links, though, because I did
.> find force forever ignore repeat void
.> link author 1-10
.> link license 1-10
forgetting that the first link command changed the meaning of the numbers. Then, because I glossed over the link
output, I didn't even realize my mistake until I did a pull-request.load
to check everything before pinging you. 😬
@anovstrup cool! will take a look at this tomorrow I think. Was tracking down https://github.com/unisonweb/unison/pull/1389 which I was concerned might affect these PRs. (Conclusion: it shouldn't in any harmful way, and we'll deploy the fix in next release)
@anovstrup awesome, thanks! added in https://github.com/unisonweb/base/commit/933481708caa5d83cab07e6cdf01c1a467ddc015 congrats on being the first outside new contributor to base!! (I missed cherry-picking repeat
, added afterwards here)
A couple notes:
copy
to just create a fresh namespace with the new definitions, without the patch history which was probably just some intermediate update during development. Suggestion below on some conventions to keep patch history clean.void
so left that one out for now, ignore
seems like what you'd use more typically. We can always add later, and obviously feel free to start keeping your own little library of utilities.We are still working out conventions for library namespaces and organizing contributions to libraries. I do have a suggestion though. When adding new definitions, do it in a separate parallel namespace, so create .prs.base.myCoolPR
(initially empty, but will have definitions with parallel naming to .base
, so if you write a new function, List.frobnicate
, it goes in prs.base.myCoolPR.List.frobnicate
).
When you're done and ready to issue the PR, you can assign license info in bulk (just find
in prs.base.myCoolPR
, then link mylicense 1-8
or whatever). You can also squash the history and discard patches using copy
to a fresh namespace.
You can then merge .prs.base.myCoolPR .base
if you like. For new definitions, you don't necessarily need to even do the merge locally, this would work as well:
.> pull-request.create https://github.com/unisonweb/base https://github.com/anovstrup/unisonweb-base:.prs.base.myCoolPR
@pchiusano Thanks, Paul! FWIW, here's the context where void
proved useful for me:
Stream.take : Nat -> '{Stream a} r ->{Stream a} ()
Stream.take n s = Stream.pipe (void s) '(repeat n '(Stream.emit Ask.ask))
-- where Stream.pipe: '{Stream a} r -> '{Ask a, Stream b} r ->{Stream b} r ; note
-- that this pipe differs from the one used in the abilities tutorial, supporting
-- use cases like logging where the result of the computation is interesting
Of course ignore . s
is only slightly more to type, but I feel like void s
expresses the intent more clearly here (especially to readers familiar with Haskell's void
).
I'm totally cool with holding off on including void
in base but wanted to give you the data point.
This Unison PR adds the following tiny utility functions, with corresponding documentation:
The changes summarized below are available for you to review, using the following command:
Added definitions: