Jules
Jules

Reputation: 6346

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.

Jules

Upvotes: 1

Views: 267

Answers (4)

Tuomas Hietanen
Tuomas Hietanen

Reputation: 5323

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

Upvotes: 1

Brian
Brian

Reputation: 118865

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

Upvotes: 2

Cay
Cay

Reputation:

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.

Upvotes: 1

em70
em70

Reputation: 6081

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).

Upvotes: 0

Related Questions