-
Notifications
You must be signed in to change notification settings - Fork 154
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 scanrPar, scanlPar #2177
add scanrPar, scanlPar #2177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the nice piece of engineering!
I think it would be better if these functions were added to Clash.Sized.RTree
(based on RTree
s then, not Vec
s) instead of creating a new small module specially for them. Is this possible?
cb98a03
to
a0e0565
Compare
|
Martijn, did you see that there are already 31 other |
Oh wow. I didn't know. |
I stand by my comment but if that's what we have there's no problem merging this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the whole looks good. Thinking out loud, I wonder if we might want to also expose scanlInductiveRTree
and scanrInductiveRTree
as scans on trees (since you can really scan anything that's foldable if you believe). If you think that's a good idea they should probably be renamed tscanl
and tscanr
to better fit with the naming convention of other RTree
functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you still need to update Clash.Prelude
and Clash.Explicit.Prelude
to have them exported there right?
No, they both export Furthermore, could you change the type to
? I suppose that overlaps with Alex's suggestion and they would be better named I'm also not satisfied with the documentation yet. I appreciate the work that went into the nice picture (though I would have named |
I see we don't have |
I don't think it's that productive to generalize (I still need documentation for |
Are you saying you don't want
or that you don't want
? The former seems to make a lot of sense to me. The function is expressed in |
FWIW, when I mentioned Unrelated: I see a merge from this branch into itself in the commit history. Since we want to keep exposing the GADT constructors for |
I think squashing everything is the way to go. |
@DigitalBrains1 yes! I expose |
A squash is fine by me. [edit] But I don't mean to say I disagree with Alex regarding separate commits, just that I don't mind either way! :-) [/edit] I think it's unnecessary to also have |
I would prefer two commits since exposing the GADT constructors to the world is an unrelated change, but I don't have particularly strong feelings about it |
I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @DigitalBrains1 on the documentation, otherwise LGTM!
Should we change the name of the GADT constructors? It's kinda odd to export things named |
I've used |
What is the reason for retaining |
@DigitalBrains1 I could remove them I suppose - but they are what is most sensibly useful! Since vectors naturally lend themselves to an idea of scanning. |
You know, it occurred to me it is not a reasonable argument, because next to [edit] The counterpart to |
Co-authored-by: Peter Lebbing <peter@digitalbrains.com>
I've pushed additional commits on the mass of commits here already, but I've also prepared a version that I think is ready to be committed with a merge commit (don't squash or rebase!) here: parallel-scan-peter. You could force-push that over this branch if you want. I'm not force-pushing here without discussing. I'd like it if someone reviewed my documentation (full changes here). I kinda feel like I had more text, but my dull head can't locate it in there. |
8b4ca25
to
227140e
Compare
Thanks! I think if documentation is up to your standard, it should be merged then :) |
227140e
to
2198bb6
Compare
I'd like either @martijnbastiaan or @alex-mckenna to review my proposed documentation. If they think it's up to snuff, we can merge (again, a merge commit, not a squash or rebase. Really, GitHub should allow you to specify what type of merge you want and then warn the committer if they are about to go against that, to prevent accidents. We don't have that, so I'll just keep repeating it 🙂). |
2198bb6
to
15deee0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great docs. Thanks @DigitalBrains1, and thanks @vmchale for the implementations :).
a5332ec
to
4f87c39
Compare
Actually, there was a real deficiency in the docs that I wrote with a rather dull brain. Before this sentence:
I added
as this is not obvious at all, I could have meant tree depth, but I didn't. While I needed to amend it anyway, I also changed "Extract the first element of an RTree" to "Extract the first element of a tree" to be more in line with the rest, same for |
This adds a low-depth scan, see [Conal Elliott's paper](https://dl.acm.org/doi/10.1145/3110251) for more. This uses a different approach, however - Haskell's "dependent types" rather than type families. Co-authored-by: Peter Lebbing <peter@digitalbrains.com>
4f87c39
to
8b85268
Compare
add scanrPar, scanlPar (copy #2177)
This adds a low-depth scan, see Conal Elliott's paper for more. This uses a different approach, however - Haskell's "dependent types" rather than type families.
I added a new module because
.hs-boot
files don't allow pattern synonyms. The alternative would be to have two parts ofClash.Sized.Vector
to avoid mutual module dependencies, which would be a larger diff.Still TODO: