
This sounds something like using a continuation function. In imperative languages, we might have something like: class MyDisplayForm { void ButtonGo_Press() { Processor.Go( new CallbackDelegate( this.SetStatus ) ); } public void SetStatus( string message ) { StatusLbl.Text = message; Application.DoEvents(); } } So: we call Processor.Go, passing in a pointer to the function SetStatus (a "delegate" in C# terminology, an "interface" in Java, a pointer in C, ...). The Processor.Go function is going to update the status bar in MyDisplayForm as it goes along with useful messages "Processing blah.txt...", etc. It does that by calling the passed in "callback" function, with the appropriate status message as a parameter. This is also implicit to the Observer pattern, which may or may not be useful in FP (?) Anyway, so the question is: how do we write callback functions in FP/Haskell? Can someone provide a simple, but functional example?