
31 Jul
2008
31 Jul
'08
7:37 p.m.
On Tue, 22 Jul 2008, L29Ah wrote:
outStanza | (isMessage) = outMessage | (isPresence) = outPresence | (isIQ) = outIQ
Why such a style doesn't work, so I must write ugly code like that:
outStanza a | (isMessage a) = outMessage a | (isPresence a) = outPresence a | (isIQ a) = outIQ a
so, guards can't be useful in point-free function definitions in any way
It's sad that syntactic sugar makes people want even more syntactic sugar (some people thus call it syntactic heroin). You can easily achieve the wanted effect by a function like 'select' http://www.haskell.org/haskellwiki/Case and that way you can also avoid guards in many cases.