[Haskell-cafe] Point-free style in guards

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue Jul 22 13:32:17 EDT 2008


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  
specific way, which in your case produces invalid code.  See http://haskell.org/onlinereport/decls.html#pattern-bindings 
  for details.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080722/054f1c0c/attachment.htm


More information about the Haskell-Cafe mailing list