Hi Corentin,
If I undestand your idea, then it is possible to do with help of continuations wrapped in a monad computation, at least with help of two continuations: (1) the main branch of computation; (2) the immediate cancellation if the result is already known.
The approach is implemented in the F# async workflow (so called the asynchronous computation) and .. in my simulation library Aivika (to model the discontinuous process). Both are monads. Only like the F# developers, I use a plain cancellation without returning the meaningful result, but nothing prevents from returning some data. Also like F# my library supports the third continuation for handling exceptions, namely the IO exceptions in terms of Haskell.
So, the keywords are: canceling the F# asynchronous computation.
Best regards,
David Sorokin
Nobody on that?
What I really want is: a computation that can be interrupted if enough result is already there.
I would be surprise if that concept doesn't exist already somewhere :)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe