-
Notifications
You must be signed in to change notification settings - Fork 39
Add more selector combinators #100
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 more selector combinators #100
Conversation
Please, don't merge yet, I'm going to add a couple of tests. |
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 couple of bikesheddy thoughts:
src/CSS/Selector.purs
Outdated
element :: String -> Selector | ||
element e = Selector (Refinement []) (Elem e) | ||
|
||
-- | The deep selector composer. | ||
-- | Maps to `sel1 sel2` in CSS. | ||
deep :: Selector -> Selector -> Selector | ||
deep a b = Selector (Refinement []) (Deep a b) | ||
infix 6 deep as ** |
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.
Maybe we could change this to |*
for a kind of consistency with >
, +
?
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.
yeah, I also think this is going to look nicer :)
src/CSS/Selector.purs
Outdated
|
||
-- | The filter selector composer, adds a filter to a selector. | ||
-- | Maps to something like `sel#filter`, `sel.filter` or `sel:filter` in CSS, | ||
-- | depending on the filter. | ||
with :: Selector -> Refinement -> Selector | ||
with (Selector (Refinement fs) e) (Refinement ps) = Selector (Refinement (fs <> ps)) e | ||
infix 6 with as ## |
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 could use &
here perhaps, since it expresses combination nicely? I guess it's not done in Haskell since &
is an operator there (that operator is actually #
in PS 😄)
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.
yeah, good point, thanks! (btw this might be a breaking change though as this operator was there before)
f07c1cb
to
bd0debd
Compare
bd0debd
to
bd25238
Compare
Ok, I've added some tests & rebased, should be ready for review. |
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 👍
Did you still want to hold off merging until things are updated for -test-unit
?
Actually I wanted to migrate tests after merging PR's :) is it ok? |
Sure thing! |
This PR is a 100% port from Clay, no other additions from my side.
Resolves #98