Hi, this combinator is called Event.merge.

1
2
3
4
5
6
7
8
9
10
 
> open System.Windows.Forms
  let frm = new Form();;
  frm.Show();;
(...)

> // Print 'something' when the mouse button is pressed or released 
  let mouse = Event.merge frm.MouseDown frm.MouseUp
  mouse |> Event.map (fun _ -> "Something!") |> Event.listen (printfn "%s");;
val mouse : IEvent<MouseEventArgs>

T.

By on 11/10/2008 3:26 AM ()

By the way, one problem is finding this documentation on the web. I just googled for "Event.merge" and "Event merge partition float map," neither brought up merge documentation. Yesterday (before your reply), I was looking at msdn docs for the Event class (I think it was DelegateEvent) and couldn't even figure out how to get to the combinators that I known for sure exist, such as map, fold.

I can't always rely on F# books (I have Foundation, Expert and Real World--pre print ;) ), since books naturally don't have the absolute latest information.

I hope better library documentation is also forthcoming. Otherwise, I love the potential of F#!

By on 11/10/2008 6:39 AM ()

If you know what module to look in, the docs are not too deep to just navigate and browse:

[link:research.microsoft.com]

click on Event module:

[link:research.microsoft.com]

But yes, as Tomas said, both docs as well as web search/links are likely to improve over time. :)

By on 11/10/2008 10:11 AM ()

If you know what module to look in, the docs are not too deep to just navigate and browse:

[link:research.microsoft.com]

click on Event module:

[link:research.microsoft.com]

But yes, as Tomas said, both docs as well as web search/links are likely to improve over time. :)

As of 24 Dec 2008, here are the updated links for the two above references:

[link:research.microsoft.com]

[link:research.microsoft.com]

By on 12/24/2008 11:42 AM ()

Yes, I agree that finding the documentation now is a bit difficult.
However, now that F# is being "productized", I'm sure the docs will improve!

In the meantime, I usually look at the FSI files in the F# source code. This gives you all the members and their type signatures and quite useful comments too, so you can often find what you need. For Event module, you can look at the file <i>[FSHARP-DIRECTORY]\source\fsharp\FSharp.Core\event.fsi<i>. T.

By on 11/10/2008 6:59 AM ()

Great! Thanks for the reply.

By on 11/10/2008 6:20 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper