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 basic properties implementation #12

Merged
merged 26 commits into from
Mar 13, 2018
Merged

Conversation

colonelpanic8
Copy link
Contributor

@colonelpanic8 colonelpanic8 commented Mar 3, 2018

Fixes #11, #13, #3

@colonelpanic8
Copy link
Contributor Author

Just realized that the current implementation won't handle multiple exports properly. I'll patch that up and post here when I'm done.

@rblaze
Copy link
Owner

rblaze commented Mar 4, 2018

Great to see someone adding new features to the library!

Unfortunately, this removes introspection for the time being. I plan to add that
back in a way that will function much better than it did previously very soon.
@colonelpanic8
Copy link
Contributor Author

The code climate issues are all just XXX warnings, but I want to leave those there for now.

I did a major version bump because these changes are backwards incompatible.

This became a pretty huge change. Let me know if you have questions.

@colonelpanic8
Copy link
Contributor Author

colonelpanic8 commented Mar 5, 2018

Here is some code that uses the new interface to export if you would like to test it:

https://github.com/IvanMalison/status-notifier-item

@colonelpanic8
Copy link
Contributor Author

If you are wondering why the changes needed to be backwards incompatible, its kind of a long story...

basically I don't think theres a good way around it, and its just going to be better to do things this way moving forward.

@rblaze
Copy link
Owner

rblaze commented Mar 6, 2018

Do we really need TemplateHaskell, IncoherentInstances? I have some reservations about using these without very serious reasons.

@colonelpanic8
Copy link
Contributor Author

TemplateHaskell is needed for the Lens on PathInfo which simplifies the code significantly. Lens is very widely used in the haskell community.

I'm not a fan of incoherentInstances, but it is needed to abstract over automethod with (IO a) since that could refer to the IO () instance or the IO v instance. I would have written that differently but this was the quickest way to get things working without rewriting that class.

This was referenced Mar 7, 2018
@rblaze
Copy link
Owner

rblaze commented Mar 7, 2018

Oh, lenses. That's explains, yes.

BTW, CodeClimate is mostly for reference, but please make sure CI builds are good.

@colonelpanic8
Copy link
Contributor Author

Tests fixed in #15

changes have become intertwined now :/

@rblaze
Copy link
Owner

rblaze commented Mar 8, 2018

I'd really prefer self-contained changesets. They are much easier to review.

@colonelpanic8
Copy link
Contributor Author

@rblaze Okay, I've done some git surgery on the two branches to make the changes separate again.

@colonelpanic8
Copy link
Contributor Author

hmmm only 7.10.2 failed. Seems to be related to the semigropoids dependency. everything else passed which is strange.

@colonelpanic8
Copy link
Contributor Author

Looks like the semigropoids issue is related to commercialhaskell/stackage#3185

@colonelpanic8
Copy link
Contributor Author

@rblaze I think this is the change that you should focus more attention on for now. It is backwards incompatbile, but it needs to be in order to properly solve #13 and support #11 in a clean way.

It also sets out the ground work for #15, and cleans up the code quite a bit IMO.

Copy link
Owner

@rblaze rblaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

examples/introspect.hs and examples/export.hs no longer compile. Given this is where people look how to use the library, they better have working examples.


-- NOTE: This instance is needed to make modifyNothingHandler work, but it
-- shouldn't really be used for much else.
instance Eq PathInfo where
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it semantically correct that two path instances are only equal if both are null?
Given that PathInfo is exported, it is better to have correct instances, not just working for the narrow case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well you can't compare the interfaces because they cointain callable objects, and functions aren't comparable. Otherwise I would have provided a better implementation.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make a comment stating this clearly, then.

import Control.Exception (SomeException, throwIO)
import Control.Monad (forever, forM_, when)
import Control.Lens hiding (coerce)
Copy link
Owner

@rblaze rblaze Mar 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Module ‘Control.Lens’ does not export ‘coerce’

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did in one of the older versions of lens. Without this one of the travis builds fails.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably one you removed already. Just checked, all builds have this warning.

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.

2 participants