[Haskell-beginners] generating the set of all finite-valued functions on a finite space

Erik Quaeghebeur equaeghe at nospammail.net
Thu Apr 23 09:45:27 EDT 2009


Hi,

I'd like to lazily generate the set of all {-1,0,1}-valued functions on 
{'a','b','c'}? How should I best approach this. I was thinking about 
generalizing the power set definition

powerset :: [a] -> [[a]]
powerset = filterM (const [True, False])

but clearly don't know enough about filterM and the like to do it this 
way.

Erik


More information about the Beginners mailing list