Re: [Haskell-cafe] Point-free style in guards

2008-07-31 Thread Henning Thielemann
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)

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Luke Palmer
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

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread J.N. Oliveira
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

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Claus Reinke
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,

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Evan Laforge
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

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Brandon S. Allbery KF8NH
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

Re: [Haskell-cafe] Point-free style in guards

2008-07-22 Thread Neil Mitchell
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

[Haskell-cafe] Point-free style in guards

2008-07-22 Thread L29Ah
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