-
Notifications
You must be signed in to change notification settings - Fork 40
Continue genericTraverse
work
#366
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
Conversation
FYI, I'm emerging from the void, and hoping to get back into some of this stuff this week. But I don't oppose your assistance. |
I mis-clicked and marked this as ready for review by accident -- trying to figure out how to undo that now. |
That's because GitHub's UI for that is awful. The "mark ready" is at the bottom, but the "convert to draft" is on the top of the right sidebar. |
Hi David! Glad to hear from you again. My suggestion is to use this rebased branch for you and Thomas to coordinate. Since this branch is hosted on the main repository and you both have commit rights, it seems like the easier solution. |
At this point, on this branch, compared to @treeowl 's one,
Here's the list of what might be required to merge this PR:
Feel free to amend this list, and select which items you want to tackle. @treeowl we can also set up a video call to sync up our work (email: firstname dot lastname at tweag dot io). |
You don't need explicit export lists on internal modules. But we ought to make sure that at least, all the classes which appear in the Haddock documentation is exported from somewhere non-internal. The |
I tried to address what I wrote in the TODO list yesterday. The docspec that I added in |
c2ca9ad
to
8953828
Compare
I expect to have time to look at it this evening. |
Well, I still don't have a lot of luck with linear generics:
Did I do anything wrong? (using |
I think GHCi may not support declaration splices at all. So you can do that in a module, but I think not in the interpreter. The |
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 that all we need is an example use in the examples/
directory. Let's call it Simple/Deriving.hs
.
Then we can merge.
`genericTraverse` is an efficient implementation of `traverse` for any `Generic1` type.
+ Public export of (linear) generic traverse through `Data.Functor.Linear` + Add comments and documentation (including a docspec) + Move from `linear-generics-0.1.0.1` to `linear-generics-0.2` + Format the codebase
8953828
to
2e072b4
Compare
examples/Generic/Traverse.hs
Outdated
deriving (Show, Prelude.Eq) | ||
|
||
instance Control.Functor WithLog where | ||
fmap f (WithLog lx x) = WithLog (logApp Nothing lx) (f x) |
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.
For what it's worth, this doesn't verify the Functor
laws, because, for instance, fmap id
is not the identity (as it get something logged). You can get away with it by asserting that the log string is not actually meaningful.
Honestly, though, I'd just use an applicative from linear-base.
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.
But we don't have many Control.Applicative
instances in linear-base. I only see Identity
, IO
, ReaderT
, StateT
, StateR
, and (,) a
. Which one would make a good example in your opinion?
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.
(,) a
is a pretty obvious candidate!
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.
Or StateT Id
. But (,) a
is likely to be the better choice.
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.
Sorry, I got confused for a moment. I thought you were looking for a Traversable
instance to derive. For an appropriate Applicative
for testing, is there such a thing as a free control applicative? Free structures tend to make good test cases.
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.
We don't have one defined. We probably could, but on the other hand, it could not be printed or compared for equality. I don't think it would actually make for a good test case.
The goal of this file is primarily to serve as a code example for documentation purposes. I think that using writer is fine. It's a perfectly serviceable applicative structure.
BTW, the reason I haven't hopped back into this as I promised is that I woke up good and sick Monday. Ugh. |
Oh 🙁 . I hope you are feeling better. |
2e072b4
to
682d85f
Compare
682d85f
to
e096e60
Compare
The idea is to bring the open PR #349 on
genericTraverse
to a conclusion. I cannot edit it directly because it is a branch originating from a @treeowl's fork.