-
Notifications
You must be signed in to change notification settings - Fork 17
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
Discussion: making HTML a typeclass #14
Comments
I attempted to make a DOM typeclass library, unrelated to Concur, but wanted to share my experience. The hardest part was trying to be polymorphic over the data types returned from the DOM methods, because they have sub-typing relationships and some other reason... So, that part of it might be unavoidable to use concrete types. |
I don't fully understand this. The view part of a widget is swappable, and nothing inside Basically to port Concur to a new backend, all you would need is rewrite the It's on my TODO list to separate out the generic Concur stuff into a purescript-concur-core package, and have purescript-concur-react depend on it. I've also been meaning to write a canvas integration as an example of using a different backend. Perhaps I should go ahead and do that once core is separated. |
@ajnsit Good to know about implementing the Say I want to write the following function: tabPageDiv' :: El'
tabPageDiv' els =
div [className "pure-g"] [
div [menuTypeClasses] [
div [tabColClasses] els
]
]
where
menuTypeClasses = classList $
map Just ["pure-menu", "pure-menu-horizontal"]
tabColClasses = classList $
map Just ["pure-u-1", "pure-u-md-1-3"] Since this uses
+1 |
The original plan was to support interop between multiple backends only at a user level, i.e. the Vue backend would define functions like But I see the value in having library code also be reusable in the same way. So a library of widgets would not import any particular backend and could be shared between different backends. I'll keep this issue open until we have this implemented. |
I just recalled backpacks, which might be useful for this. But I don't think Purescript has them yet: https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst#motivation |
Just to discuss your original plan:
I've come across other areas in PureScript where I could really benefit from some template-based programming, using something like a pre-processor (though a non-existent PureScript-specific templating system might be preferable, I doubt it will happen anytime soon). Perhaps using something like e.g. heterocephalus or haji, but this would at least be a simple application of it. |
I was thinking of creating a small CSS wrapper library for Prism.CSS and Concur. This may or may not be a good idea - too early to tell. But, it made me realize that
HTML
might be better off as a typeclass with all the element functions as typeclass members, because libraries that depend onHTML
might want to do it an implementation-independent fashion (rather than relying specifically on, say, React).To be clear it isn't something I'm in need of anytime soon.
The text was updated successfully, but these errors were encountered: