Tutorial :Is there a builder for F# events?


Events work much like sequences in F#. You can use sequence expressions with sequences. Is there a similar builder for events? I couldn't find it.

If it doesn't exist, then why not? (is it imposssible or not suitable?) If the answer is that it's just not implemented yet then I'm going to give it a try.



Tomas has done some research here, and this does seem a fruitful avenue.


Maybe this helps:

Check Events in F# on how to create custom events. Then you could create a sequence and map, filter and iterate them.


Reactive Extensions (Rx): http://msdn.microsoft.com/en-us/data/gg577609

and Ryan Riley's observe { ... } builder for Rx 2.0: https://github.com/panesofglass/FSharp.Reactive


While for sequences it makes sense to create a group of objects to process, for events it would be totally pointless. Please consider that events are just means to provide a reaction to something going on externally, so you should never need an event builder. If you've got an event handler doing some processing, you can easily split the logic and the event processing into separate functions and apply the function to data you're actually able to generate in advance or according to known rules and in a known order (for which you could actually use a sequence expression).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »