1

Working with reflex-frp I have a list of entries which contain a text input. I also have a button that on click should trigger n http requests where n is the number of entries, and each request should contain the corresponding text. Therefore I have,

Event t [Text]

In order to send the requests I was trying to use

performRequestAsync :: MonadWidget t m => Event t XhrRequest -> m (Event t XhrResponse)

Therefore I need somehow a function that allows me to convert my event of list into a list of events:

Event t [Text] -> [Event t Text]

But I am not finding any way to do so. The most promising approach seems to involve the fan function and an EventSelector but I'm not being able to make much sense of it and there isn't much documentation online.

Is this possible?

Jesuspc
  • 1,664
  • 10
  • 25
  • What have you tried? It seems that `fan` or `fanMap` would work - what about these functions are you having difficulty with? – user2407038 Sep 28 '17 at 20:45
  • Using fan or fanMap you seem to have to know exact keys with which you'll be selecting events. Here the list is dynamic so you can't know the length - you can't pull it from the event. So it looks like it all was designed to countermeasure such an idea. Anyway creating multiple request for each element of the list is very unelegant and unefficient. If it's possible you should change your server API to allow batch requests. – Michał Adamczyk Sep 28 '17 at 23:04

0 Answers0