[Haskell-cafe] Implementing Las Vegas algorithms in Haskell
Jason Dagit
dagit at codersbase.com
Tue Jul 7 00:03:15 EDT 2009
2009/7/6 Matthias Görgens <matthias.goergens at googlemail.com>
> A Las Vegas algorithm, like randomized quicksort, uses a source of
> randomness to make certain decisions. However its output is
> unaffected by the randomness. So a function
>
> > f :: RandomGen g => g -> a -> b
>
> implementing a Las-Vegas-Algorithm 'looks' like a pure function,
> ignoring its first argument and depending solely on its second
> argument. What is an idiomatic way to implement such a function? I
> believe, Monads are too linear and strict.
I believe this would be a good place to apply "implicit configurations".
http://okmij.org/ftp/Haskell/types.html#Prepose
Let me know if it solves your problem. What I recall of the paper is that
it should work nicely for your situation.
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090706/8c63452c/attachment.html
More information about the Haskell-Cafe
mailing list