Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Simplify #10

Merged
merged 21 commits into from
Oct 2, 2017
Merged

Simplify #10

merged 21 commits into from
Oct 2, 2017

Conversation

ethul
Copy link
Owner

@ethul ethul commented Sep 2, 2017

No description provided.

@ethul
Copy link
Owner Author

ethul commented Sep 5, 2017

I've been experimenting with some breaking changes in this PR.

I am considering merging this in soon, but I definitely open to any feedback you might have since you've all contributed to the repository. Thanks!

@coot @pbrant @felixSchl

PS - Updates to the example
ethul/purescript-react-redux-example#2

@felixSchl
Copy link
Contributor

No objections here, looks good to me.

Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

Some minor things; overall it looks good to me. I much prefer the newtype wrappers over the previous approach.

connect slens class_ = runFn3 connectFn Tuple (view slens) class_

connect_ :: forall props state. Getter' state props -> React.ReactClass props -> ReduxReactClass' state props
connect_ :: forall props state. Getter' state props -> React.ReactClass props -> ReactClass' state props
connect_ slens class_ = connect slens' class_
where
slens' :: Getter' (Tuple state Unit) props
slens' = to (view slens <<< fst)
Copy link
Contributor

Choose a reason for hiding this comment

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

why not slens <<< _1 _1 is in Data.Lens.Lens.Tuple

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think you are looking at an outdated version here. connect does not use Getter' in the latest version.

@@ -139,9 +135,9 @@ foreign import data REDUX :: Effect

foreign import data Store :: Type -> Type -> Type

foreign import data ReduxReactClass :: Type -> Type -> Type -> Type
foreign import data ReactClass :: Type -> Type -> Type -> Type
Copy link
Contributor

Choose a reason for hiding this comment

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

This will affect error messages. PureScript doesn't show qualified type names (or maybe it's just a problem of psa?). This might lead to some confusion when reading an error message.

Copy link
Owner Author

Choose a reason for hiding this comment

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

And for this, I think you are looking at an outdated version. This has been renamed to ConnectClass.

@@ -39,7 +39,7 @@ import React as React

import Unsafe.Coerce (unsafeCoerce)

type ConnectClass' state props = ConnectClass state () props
type ConnectClass' state props = ConnectClass state (Record ()) props
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just {} instead of Record ()?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good call. I will update this.

@ethul
Copy link
Owner Author

ethul commented Sep 5, 2017

Thanks for all of your feedback! I want to make a few more small changes, but should get this out in a release soon.

@pbrant
Copy link
Contributor

pbrant commented Sep 5, 2017

A little late to the party, but I like this too. Ditto on the move to newtypes. Thanks for continuing to experiment with this.

@ethul
Copy link
Owner Author

ethul commented Sep 5, 2017

Thanks for taking a look @pbrant!

@ethul
Copy link
Owner Author

ethul commented Sep 5, 2017

@BartAdv you had some good ideas in #6. I am wondering if you had any thoughts on the proposed changes here. Any feedback is definitely appreciated!

@ethul
Copy link
Owner Author

ethul commented Sep 5, 2017

Just to note, release of these changes depends on purescript/purescript-record#7

@BartAdv
Copy link

BartAdv commented Sep 11, 2017

@ethul quite a lot of changes! This means, unfortunately, I won't be able to dig into this stuff, as I'm not using this library at this moment.

@felixSchl
Copy link
Contributor

Will this be possible with this simplification? Or should I create a separate issue? Essentially I want to pass the { withRef: true} option to connect

@ethul
Copy link
Owner Author

ethul commented Sep 12, 2017

@felixSchl Good call! No need to raise an issue. I will look into incorporating that into this PR. Thanks!

@ethul
Copy link
Owner Author

ethul commented Sep 14, 2017

@BartAdv Indeed! Revamping a lot in this PR. Thanks for the update!

@ethul ethul merged commit 431ac5b into master Oct 2, 2017
@ethul ethul deleted the simplify branch October 2, 2017 21:36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants