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

You just have to avoid all those pointless language constructs
that let mere Haskellers deal with points, and define your own:

   import Control.Monad
   import Data.Maybe
   import Control.Arrow((&&&))

   g |= rhs = uncurry (>>) . ((guard . g) &&& (return . rhs))
   a +++ b  = uncurry mplus . (a &&& b)
   (=|)     = (fromJust .)

   outStanza = (=|) (((=="m") |= ("message: "++))
                +++  ((=="p") |= ("presence: "++))
                +++  ((=="i") |= ("iq: "++)) )

Sorry about mentioning those Strings, but then the names shouldn't
really mention the points (Stanza/Message/..), either, right? Or have
I missed the point of this exercise?-)

Claus

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to