Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michael Trotter
    @spicydonuts
    and then propose a smolder pr to replace optionalWith with that function
    Michael Trotter
    @spicydonuts
    going to close gitter.. can only have so many chat programs open..
    in fpchat #purescript though
    thanks for the help
    Greg Wiley
    @aztecrex
    what is the right way to run an effect that attaches to a DOM element in PUX? in this case it's a Google authentication call 'auth.attachClickHandler'. it takes an element id and installs all the magic google authentication flow to the corresponding DOM element.
    i have an FFI module that successfully loads the auth object and I am successfully using it to put login status changes to a Signal. but I have no idea where in my code I can know that I have a rendered document and am simultaneously in Eff (or Aff)
    i suppose I could use an action. but would that be a race with rendering?
    Fabian Beuke
    @madnight
    @aztecrex question still exist?
    Marcin Biernat
    @biern
    Hi, I'm trying to figure out how to best achieve the following and would appreciate an advice. There is an effect that reads a file chunk by chunk and I need to display the progress of that operation. As far as I understand 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:
    • Create new channel in main
    • Connect a new Signal to that channel
    • Pass the signal as an input
    • Curry the foldp with channel and eventually pass it to the effect
    • Knowing the channel effect can send values there
      I'm new to pux and purescript in general and I'm wondering if I am overcomplicating that thing entirely and there is some more canonical way to do that?
    Fabian Beuke
    @madnight
    @biern you might want to use a web worker http://jandupal.com/Web-Workers-in-PureScript-part-I/ which is periodically reporting its status
    Marcin Biernat
    @biern
    @madnight Thanks a lot, using the web workers certainly makes sense here. As I understand it will also simplify the flow since I can directly use makeChan in both the main to create an input from res and in effect, to schedule jobs using req.
    Marcin Biernat
    @biern
    That's not strictly related but I'm wondering, is it possible with pux to somehow get a signal of application events and use it to generate further events? For example, to emit RequestURL foo event after debouncing ButtonFooPressedfor 1000ms
    Fabian Beuke
    @madnight
    @biern sure you can create more events in "effects" example in my code base https://github.com/madnight/grendy/blob/master/src/App/Events.purs#L78
    there i have a Event "ReceiveTodos" that performs some effects and then emits "SetTodos" which sets the todos i received
    Marcin Biernat
    @biern
    @madnight Thanks, but that I know already. I'm asking specifically if it is possible to use purescript-signals in pux to connect to a signal of app events and use it to emit further events with operators such as debounce or sampleOn . I can see that signals from the outside can be passed into inputs of the app, but it's not possible to have a signal of app events before the app is initialized :)
    Fabian Beuke
    @madnight
    @biern hmm could you explain that problem with an actual example?
    Marcin Biernat
    @biern
    @madnight Sure, so maybe a good example would be implementing an input with suggestions. When a user is typing something into that input, only after a brief moment of inactivity, let's say 500ms without typing any letter, the app would fire a request to an API that returns a search suggestion to display to the user. Each letter typed generates an event. Having an events :: Signal Event one could just use something like suggestions = debounce 500 $ filter (eq KeyPressed) $ events ~> QueryAPI (this code might be totally wrong).
    Fabian Beuke
    @madnight
    Marcin Biernat
    @biern
    Right, but the complex part in this example is firing the API request (QueryAPI event) 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 KeyPressed and cancel if the next one happens in given window. That's still manageable but just more complex.
    Bryan Vicknair
    @bryanvick
    I'd like my foldp function to run in a WriterT, but I can't just wrap the foldp field of Config with a runWriterT call. So I think I may need to write an alternate implementation of Pux.start. Has anyone worked out how to write their foldp functions in a Monad transformer?
    Bryan Vicknair
    @bryanvick
    In the past, I've simply used my State to implement a sort-of Writer monad with foldp, but I guess I'm wondering if anyone has any experience getting foldp to run in a Monad transformer in general.
    Fabian Beuke
    @madnight
    did someone ever used "onScroll"?
    Gustavo Aguiar
    @gugahoa
    Hello, everyone, how should I go about learning PureScript?
    Any knowledge which would be useful to learn beforehand? Or some learning material to use alongside books? (Anything which would be a learning resource, really)
    Claudia Doppioslash
    @doppioslash
    hi @gugahoa, it depends where you're starting from, if you already have some FP or Haskell background
    if you have some FP background the official Purescript book is good https://leanpub.com/purescript/read
    if not maybe you could also use Haskell from First Principles http://haskellbook.com/
    there are Purescript videos on egghead.io https://egghead.io/technologies/purescript
    and exercises on exercism.io http://exercism.io/languages/purescript/about
    Gustavo Aguiar
    @gugahoa
    @doppioslash thanks! I'm going by the Purescript book while also reading Haskell Book
    It's going well so far :smile:
    Claudia Doppioslash
    @doppioslash
    @gugahoa cool :D
    Gustavo Aguiar
    @gugahoa
    I asked in purescript/purescript, but though I could ask here too. I'm looking for ideas for projects in PureScript which would exercise a good bunch of the language's feature. Any idea, @doppioslash? :grin:
    Claudia Doppioslash
    @doppioslash
    I think any non-trivial project will work for that. Purescript is well suited (due to availability of libraries) to:
    @gugahoa ^
    Gustavo Aguiar
    @gugahoa
    Thanks, @doppioslash ! I'll work toward a Facebook Messenger clone then. Seems like something with enough complexity :D
    Mark Eibes
    @i-am-the-slime
    Good evening
    Carsten
    @CarstenKoenig
    hi - just a quick question: is there a simple way to have an "initial effect" in Pux (load data from server after the application started)?
    I can see how I could just send the Aff and use a signal for the return but that feels a bit hacky and as this is probably a common use case I hope there is something there already I just don't see
    kapilpipaliya
    @kapilpipaliya
    i have already a big project in react. i want to port it to purescript. does pux is the right library? does its performance can create significant problem?
    Mauricio Fierro
    @mauriciofierrom
    Hello, I have a little question. I am trying to make my app respond to URL input in the browser, i.e. if I enter /something it should take me to the desired view, but it fails with Cannot GET /something. Click events work alright. Any advice would be appreciated : )
    Brian Marick
    @marick

    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 <> " "
    But I don't know how to make the focus name render as big text whereas the other names are buttons (that will switch the focus to them).
    Michael Dougherty
    @maackle

    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?

    Joe Gesualdo
    @joegesualdo
    I’ve also been experiencing performance issues with Pux in a sizable application that triggers many events per second. Unfortunately, there doesn’t seem to be much activity in the Pux community, either on the github repo or here on Gitter 😞
    Joshua Smith
    @JoshSmithCode
    Hey, just getting started with purescript and using pux to explore since I'm familiar with Elm. Currently trying to implement a basic SPA and would like to use hash-based routing just so I don't need to implement a routing server/backend. Is this easily achievable with Pux? I've found other Purescript routing libraries that I could implement to use hash-based routing but since I'm new to the whole purescript/pux ecosystem I wanted to stay as simple as possible for now.
    Andrey Prokopenko
    @swamp-agr
    Hi! I want to publish in the nearest future pux-based SPA I am currently working on. Visa calculator. May I ask you for permission to post the URL in this chat once it will be deployed?
    kapilpipaliya
    @kapilpipaliya
    Hello I have a complete project in ReactJs, using mobx and many other libraries. how can i migrate it to pux?
    nukisman
    @nukisman
    Is Pux alive?