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)
2008/7/22 J.N. Oliveira <[EMAIL PROTECTED]>:
> But you still need the extra parentheses...
Not so!
infixl 0 .|
infixl 0 .|... -- 'otherwise' construct
infix 1 .=
(.=) :: (a -> Bool) -> (a -> b) -> (a -> Maybe b)
(.|) :: (a -> Maybe b) -> (a -> Maybe b) -> (a -> Maybe b)
(.|...) :: (a -> Maybe b
On Jul 22, 2008, at 6:32 PM, Brandon S. Allbery KF8NH wrote:
On Jul 22, 2008, at 13:18 , L29Ah wrote:
outStanza | (isMessage) = outMessage
| (isPresence) = outPresence
| (isIQ) = outIQ
Why such a style doesn't work, so I must write ugly code like that:
Because the H
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,
On Tue, Jul 22, 2008 at 10:27 AM, Neil Mitchell <[EMAIL PROTECTED]> wrote:
> 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
On Jul 22, 2008, at 13:18 , L29Ah wrote:
outStanza | (isMessage) = outMessage
| (isPresence) = outPresence
| (isIQ) = outIQ
Why such a style doesn't work, so I must write ugly code like that:
Because the Haskell 98 Report specifies that guards are rewritten in a
sp
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 | isMess
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