-
Notifications
You must be signed in to change notification settings - Fork 5
alternative monadic API: concrete example with code #8
Comments
here, |
there is some more low hanging fruits to harvest here: here: type VDomBuilder e a = StateT (Array (VDom e)) (Eff (h::H|e)) a
type NodeBuilder e = VDomBuilder e Unit -> VDomBuilder e Unit
|
below is a copy-paste of #3 (comment) (I copied it here because I think it may be more relevant in this thread) I tried various different designs: this one is best one I found so far based on all constrainsts I gave myself:
I didn't test it extensively, so there might be important problems I did not see 📝 as a bonus, the monadic api could allow user to suply their own monadtransformers with some reader monad providing configuration, or globally available message bus via handlers. Halogen permit this, and this is from what I saw very usefull (I played with elm pre 0.17 and post 0.17, pux, halogen and various other UI libs, and the pure functional paradigm quickly becomes annoying without this. Here, it comes for free, at almost no cost) |
Kudos to you for putting in such a large amount of effort! I really appreciate it! Few thoughts: That's all for now, I'm sure over the coming weeks (there's a lot of other things on the roadmap) I'll be gaining more insight and will continue to update you :) |
thank you :)
I tweaked a few things trying to reduce the complexity. From what I saw of scala, I think scala could have the same api without much problems
I completely agree.
🍏 the store pattern becomes directly available with a monadic api, because the monad can provide some global stores shared amongst components I also discovered some nice byproducts of using a monadic api (not geting in the way of beginners, but just available for more complex things): some |
2 small precisions: 1 - So far, I have found the monadic API more pleasant, correct, and powerfull, but I haven't played enough to weight the cons correctly, so don't take this arguments too seriously :) 2 - OutWatch simplicity is something I loved at first sight, and something I also really care about. |
So I've bottled it down to three realistic solutions, I think:
And of course there's 4. Don't change the current API at all and acknowledge it's impureness. Maybe change the Signature of I don't really have a huge preference right now, would probably have to build some example apps in each (which could take a while) :) |
thanks for the feedback ! I've just shared what I experimented with over the last days here: #9 it's not even half done, but I'm just sharing in case you have some feedback. |
based on #7 and #3, I gave a try to some alternative monadic API
📝 operators like
==>
,<==
, and:=
are gone📝 no more
[,,,]
lists neitherit seems to works well.
the only thing missing seems to be some
so components can still create dynamically subcomponents with personal handlers for inner state management.
@LukaJCB how does it look ?
The text was updated successfully, but these errors were encountered: