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

A capability typeclass for making HTML components? #3

Closed
armanbilge opened this issue Mar 23, 2022 · 6 comments · Fixed by #107
Closed

A capability typeclass for making HTML components? #3

armanbilge opened this issue Mar 23, 2022 · 6 comments · Fixed by #107

Comments

@armanbilge
Copy link
Owner

So we don't have to pass Async everywhere 🤔

@armanbilge
Copy link
Owner Author

The Async constraint is largely driven by the switching between F[_] and Rx[F, _] I believe (specifically the evalOn?). That seems harder to make go away.

@armanbilge
Copy link
Owner Author

As of #18, I think what is currently Dsl[F] can become a capability typeclass, that along with Concurrent should be more than enough to make interesting interactive components.

@armanbilge armanbilge modified the milestone: v0.1.0 Apr 17, 2022
@armanbilge
Copy link
Owner Author

This is actually really hard, not necessarily technically, but in terms of sheer amount of work.

Any interaction with the raw DOM will need Sync (at least). So unless/until all of that is wrapped up nicely in pure APIs, users will still be reaching for Sync anyway.

@armanbilge
Copy link
Owner Author

So unless/until all of that is wrapped up nicely in pure APIs, users will still be reaching for Sync anyway.

It's still crazy ambitious, but fs2-dom is where this might happen.
https://github.com/armanbilge/fs2-dom/

The Smart:tm: thing to do would be to whip up a custom blend of ScalablyTyped that does this wrapping automatically. See scala-js/scala-js-dom#487 (reply in thread).

@armanbilge
Copy link
Owner Author

So unless/until all of that is wrapped up nicely in pure APIs, users will still be reaching for Sync anyway.

Another note about this. If we indeed go the wrapper route with something like

class HtmlElement[F[_]](raw: dom.HTMLElement)(using F: Async[F])

That means that every node in our DOM tree will need another allocation. I am not really sure if that's a good idea.

OTOH if we wrapped everything in IO we could avoid the allocation via an opaque type. It would not help with the typeclass / tagless final route, but an IO-based API is still better than an unsafe one. Something to think about.


The redesign work I'm doing for 0.2 will close this specific issue, but the wrapper issue persists.

@armanbilge
Copy link
Owner Author

Actually, I guess we could do it via ops typeclasses 🤔

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 a pull request may close this issue.

1 participant