logo       

Re: Guards (Was: Some random newbie questions): msg#00097

lang.haskell.cafe

Subject: Re: Guards (Was: Some random newbie questions)

Henning Thielemann wrote:
What about dropping Guards? :-) Are they necessary? Do they lead to more
readable source code? Do they lead to more efficient code? I could
perfectly live without them up to now.

I hardly need guards too, but their advantage is that they let pattern matching fail, resulting in trying out following patterns.

case l of
[i] | i /= 0 -> (/i)
_ -> error "a single message here for all other cases"

Cheers Christian


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise