[Haskell-cafe] Callback functions?

Hugh Perkins hughperkins at gmail.com
Mon Jul 2 19:00:04 EDT 2007


> http://cvs.haskell.org/cgi-bin
>
> /cvsweb.cgi/fptools/libraries/GLUT/examples/RedBook/


Ok, I'll take a look

> What makes a callback different from any other kind of function?

Well... what about inside monads?  Does this break purity???  Does this
require adding IO to the monad if the callback function does IO?

As I'm writing this I kindof have this sense inside me that this is a really
newbie-ish question.  That the answer is no it doesnt break purity, yes it
does require adding IO to the monad, but I'm asking anyway just to check :-)

On 7/3/07, Dan Piponi <dpiponi at gmail.com> wrote:
>
> On 7/2/07, Hugh Perkins <hughperkins at gmail.com> wrote:
>
> > Anyway, so the question is: how do we write callback functions in
> > FP/Haskell?  Can someone provide a simple, but functional example?
>
> What makes a callback different from any other kind of function? In
> Haskell, as in other functional programming languages, you're
> completely free to pass functions into other functions and store them
> in datastructures. Take a look at the 'callbacks' used in the HOpenGL
> examples. They're just ordinary functions:
>
> http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/GLUT/examples/RedBook/
> --
> Dan
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070703/8b6af975/attachment-0001.htm


More information about the Haskell-Cafe mailing list