+
Skip to content

Conversation

armanbilge
Copy link
Owner

This generalizes the existing machinery in HtmlTag so that it can replicated more easily in userland e.g. to support:

def MyComponent[M](mods: M)(using Modifier[IO, HtmlDivElement[IO], M]) = 
  div(
    cls := "custom-class",
    otherMod1,
    otherMod2,
    mods
  )

h/t @yurique

@armanbilge
Copy link
Owner Author

Heh, this completely broke things 😅 not-so-gentle-reminded we need a test suite.

Comment on lines 78 to 81
private trait ModifierLowPriority:
given forFoldable[F[_], E <: fs2.dom.Node[F], G[_]: Foldable, A](
using M: Modifier[F, E, A]): Modifier[F, E, G[A]] =
(ga, e) => ga.foldMapM(M.modify(_, e)).void
Copy link
Owner Author

Choose a reason for hiding this comment

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

Unfortunately this is causing a lot of angst, because Tuple also has foldable instances. Sadly I wonder if I should remove it in favor of instances specifically for List and stuff.

Indeed, this is what caused the original bug when I attempted to implement this.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Replaced with a List-specific instance.

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 Option instance too :) hopefully those are the main ones.

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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载