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 bulk attribute setter operator #226

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ggreif
Copy link
Contributor

@ggreif ggreif commented Jul 12, 2018

This allows us to write

SVG.marker #=
    [ (SVG.id, "arrow")
    , (SVG.viewBox, "0 0 10 10")
    , (SVG.refx, "5")
    , (SVG.refy, "5")
    , (SVG.markerWidth, "6")
    , (SVG.markerHeight, "6")
    , (SVG.orient, "auto")]
           #+ [SVG.path # set SVG.d "M0 0L10 5L0 10z"]

Importantly, the attribute list can come from any Foldable container.

Stuff to check:

  • is there a nicer symbol for the operator (#=)?
  • is foldl the correct way to do it?
  • is the attribute order relevant (i.e. should we reverse it)?
  • squash commits (can be done on merge)
  • need to add tests?
  • version bump necessary

This allows us to write
``` haskell
SVG.marker #=
    [ (SVG.id, "arrow")
    , (SVG.viewBox, "0 0 10 10")
    , (SVG.refx, "5")
    , (SVG.refy, "5")
    , (SVG.markerWidth, "6")
    , (SVG.markerHeight, "6")
    , (SVG.orient, "auto")]
          #+ [SVG.path # set SVG.d "M0 0L10 5L0 10z"]
```
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.

1 participant