[Haskell-cafe] powerSet = filterM (const [True,
False]) ... is this obfuscated haskell?
sebf at informatik.uni-kiel.de
Tue Jul 28 04:58:53 EDT 2009
> The M is the list, i.e. nondeterminism monad. For each element in
> the list, there is one return value where it appears (True), and one
> where it does not (False).
This discussion made Curry  programmers realise the beauty of non-
determinism and lead to interesting reformulations of common list
Here are some of them translated to Haskell:
inits = takeWhileM (const [True,False])
tails = dropWhileM (const [True,False])
perms = sortByM (const [True,False])
Only that Hoogle does not know any of these monadic helper functions.
: unfortunately not yet in the mailing list archive (<http://www.informatik.uni-kiel.de/~mh/curry/listarchive/
> Thread title: "beautiful non-determinism")
Underestimating the novelty of the future is a time-honored tradition.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe