[Haskell-beginners] nested guards

Stephen Tetley stephen.tetley at gmail.com
Fri Feb 3 23:30:58 CET 2012

On 3 February 2012 20:16, David Frey <dpfrey at shaw.ca> wrote:
> http://www.haskell.org/haskellwiki/Case
> That link shows how to write a select function that offers functionality
> similar to a switch statement in C.  Then you could use guards for the
> top-level switching and the select function for the second level.

Yikes - that idiom is rather horrible, vis packing cases into a list
so they can be consumed by a function.

To solve the problem, I'd seek a more "mathy" description of the
algorithm i.e. one that doesn't use conditionals so heavily and work
from that rather than translate existing code.

More information about the Beginners mailing list