effects, they can generate events only after the process is finished, so to get multiple events, the effect would have to be split into small per chunk operations, each ending with an event. I suppose that's not the most efficient way to do that, and there's no need to have an event on each chunk read and I looked into
Signal. So I ended up doing following:
Signalto that channel
channeland eventually pass it to the
purescript-signalsin pux to connect to a signal of app events and use it to emit further events with operators such as
sampleOn. I can see that signals from the outside can be passed into
inputsof the app, but it's not possible to have a signal of app events before the app is initialized :)
events :: Signal Eventone could just use something like
suggestions = debounce 500 $ filter (eq KeyPressed) $ events ~> QueryAPI(this code might be totally wrong).
QueryAPIevent) with the correct timing. Signals make stuff like this pretty easy. As far as I can tell, without them you need to manage timeouts yourself, eg. create them after each
KeyPressedand cancel if the next one happens in given window. That's still manageable but just more complex.
I'm trying to convert an Elm app to purescript-pux. Hard bit is turning out to be understanding Smolder. The examples I've found don't show helpful functions, embedding buttons in HTML, etc.
What I'm most looking for are nontrivial examples. But if you want to look at what I'm trying to do....
Here's the Elm code:
viewSelector : String -> List String -> Html Msg viewSelector focus all = let one name = span  [ case name == focus of True -> strong [style [("font-size", "2em")]] [text focus] False -> button (ChoosePerson name) name , text " " ] in p  (List.map one all ++ [button (ChoosePerson "joe") errorSymbol])
... called from:
view : Model -> Html Msg view model = div [ style [("margin", "4em")]] [ viewSelector model.focusPerson <| Dict.keys model.words , viewSelected model , viewStatistics model ]
My custom button works:
clickme :: Event -> String -> HTML Event clickme event label = button #! onClick (const event) $ strong (text label)
... and a function like this works:
viewSelector :: forall ignored. String -> List String -> Markup ignored viewSelector focusName names = p do for_ names markup where markup name = text $ name <> " "
The pux readme states:
Pux has not focused on performance yet. The slow performance arises from translating Pux's (smolder) virtual DOM to React's virtual DOM. The goal is to write a purescript virtual DOM module for smolder, which would avoid that translation step and could be optimized for a monadic datastructure. I suspect this would achieve performance on par with Halogen.
I'm writing a pretty sizable app in Pux now, partially as a learning experience, but would like to use it all the way if possible. I'm already noticing bad performance though. I can't find any reference to plans for optimizing the vdom translation, are there any such plans in the works?