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