
Hi
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
You can make it slightly prettier, since the brackets are not necessary: outStanza a | isMessage a = outMessage a | isPresence a = outPresence a | isIQ a = outIQ a Although I suspect that outMessage crashes if isMessage returns False? And perhaps outMessage is written as outMessage (Message a b) = ... In which case, I'd write: outStanza (Message a b) = ... And then the code no longer looks ugly, uses pattern matching nicely, requires no "is..." functions and won't crash if things like outMessage are called incorrectly. [Note, everything beyond the no need for brackets is a bit of a guess, just possible ideas to think about] Thanks Neil