-
Notifications
You must be signed in to change notification settings - Fork 216
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
Polish halogen for public release #24
Comments
|
Let's hold off on (5) then because I'd rather whatever solution we end up with for PureScript 0.7 not be tied to the bower or NPM ecosystems. As for (4), I do think some AJAX would be nice, or maybe IndexedDB which has async and is global. |
Oh, on (3), the reason I suggested finally tagless is that it removes the need for intermediate structures. |
So here are a few notes after an initial attempt at a finally tagless encoding:
|
Maybe something like class (Functor (node a), Functor attr) <= HTMLRepr node attr where
text :: forall a i. String -> node a i
element :: forall a i. TagName -> attr i -> node a i
hashed :: forall a i. Hashcode -> (Unit -> node a i) -> node a i
placeholder :: forall a i. a -> node a i
attribute :: forall i. AttributeName -> String -> attr i
eventHandler :: forall i fields. EventHandlerName fields -> (Event fields -> EventHandler i) -> attr i
newtype HTML a i = HTML (forall node attr. (HTMLRepr node attr) => node a i) I feel like we might end up running into ambiguous type errors with this though. |
@jdegoes Finally, regarding your point about data structures, I think we will still have to create a large intermediate data structure - a function taking a dictionary for a representation to the representation itself. I don't really have good evidence in favor of either one in terms of performance, but please see my list of concerns above. One thing I like about this representation, which you can't do easily in the original one, is the way you can tie the I'm going to be busy for the next few days, but hopefully there's enough here that you can make some progress on porting |
These seem to be pretty fatal errors to me. 😦 Let's just leave it like it is, though it's not generic, it'll be faster than free. We can always go back and generalize it later if we find a performant way or decide that the cost of Free is acceptable. |
I'll defer to your judgement on whether or not we should pursue this. Have fun on your vacation! |
I was thinking about this last night and came up with this idea:
This could be a neat solution if it gives a good performance improvement, but it runs the risk of just adding extra complexity if not. |
Interesting. I'd definitely love to make the |
I had a stab at a final representation in the @jdegoes What are your thoughts on the status of the library now? |
I've broken up the docs a little more as well, which I think makes them a bit more readable. |
Well, I'd like to see Otherwise, the library is looking really solid -- what sorts of changes do we need to make before '1.0'? Oh, I guess an Ajax + Timer example would be useful (maybe using affjax?). |
So, I split the Yes, I'll add a timer/AJAX example, probably tomorrow. If it's possible to cut a 0.1.0 of |
I've added a couple of additional examples: a counter, to illustrate driving the application with a timer in Did I miss anything? Other than the finally tagless changes, which I think are still a little way off, I think most of the basics are now covered. |
Could you add |
Yep, can do. |
@cryogenian Done, please let me know what you think. |
Great! Thank you! |
@paf31 The placeholder example is good, but it would be nice to include a real As far as I can tell, there are a few things still in-progress:
Additionally, looking at runUI, I feel like there are some abstractions here which could be extracted out, and composed in a limited number of (nonetheless useful) ways. But honestly, I think what we have is good enough and probably not going to change in completely onerous ways, that we can probably ship a version now, announce it, and start trying to build a community. I think it's probably 0.4 or maybe 0.5, giving us some time to iron out issues before a 1.0 release. What do you think? |
Agreed, can do.
Yes, we can add support for some more components, and I have a short list of prioritized ones, but I don't think this would hold up a release.
I can spend some more time on this. My impression is that it will require us to break a few things up, and it will change the way we handle things like traversals and some components, so if we want to do it, I should probably get it done before a release.
This seems like something which could make up a fairly large independent project. Since we can do all static things with
I can definitely move over to
Interesting, anything in particular?
That makes sense. I'll have another stab at finally tagless HTML tonight and see where I get to, then maybe we can discuss making a release? |
OK, sounds good. If it looks like this is not paying for itself, then let's can it. It may have a lot of potential, but the devil is in the details.
In my experience, this isn't true. The old nodewebkit version of SlamData would crash all the time in unrecoverable ways. Mainly because The current design with Further, any After I get through #3, That's a good point about In any case, I'm fine punting on this until I do more work on
Not spending more than 60 seconds, but something like: data View a r i = View (SF1 i (HTML a (Either i r))) -- Should be These, i.e. i, r, or both i and r?
data Renderer a = Renderer (a -> VTree)
data Effector eff r i = Effector (r -> Queue i)
data UI eff a r i = UI { view :: View a r i, renderer :: Renderer a, effector :: Effector eff r i }
runUI :: forall eff a r i. UI eff a r i -> Eff (HalogenEffects eff) Node The pieces and the whole compose in various ways, though I need more time to think about how this would be useful. Note I changed |
Super duper! I hope your workshop at LambdaConf is going to touch on Halogen a bit, too. 😄 |
Ok, I'm sold on I see what you mean about the various newtypes ( I'm beginning to think I'll retitle my LC talk to be about reactive web apps more generally. Thermite might make a good conceptual overview, but I think I'd enjoy talking about Halogen more :) |
I'll break the remaining items out into their own issues, so that I can track them in a milestone, and close this. |
Agreed. My suggestion to "just log" was only to achieve parity with the One could imagine adding an error handler to the definition of a data UI eff a r i = UI { view :: View a r i, renderer :: Renderer a, effector :: Effector eff r i, handleError :: Error -> Aff eff Unit } Or some such. Not saying it's a good idea, though, but gets the errors out of the So many times for SlamData nodewebkit, apps would die and we'd not have any information on what got them into that state. Taking a different approach this time around (every
Yeah, if there's nothing useful there (including
Super. 😃 |
The tricky bit with errors is that if we want them to show up in the UI at all, they have to appear in the type of the |
Is it possible to have the type of |
I don't mind it, like you say, it's a way of working around "extensible coproducts" or some such while minimizing boilerplate. The errors probably do need to be inputs to the state machine because I can't imagine a scenario where you wouldn't want the user to know about the error. Presumably the view would log them (i.e. using a request handled by the Handler function) as well as display them. So I don't think there's anything wrong with the current approach.
Sure, via phantom types, for example, but then you can't compose them using |
Halogen's quickly approaching the point where I think we should do a public release / announcement.
Here's some things I'd like to see before we do that:
Aff
in more places which do not require an immediate return value? Etc.The text was updated successfully, but these errors were encountered: