[Haskell-cafe] concurrent definitions with parsec

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Mar 10 09:45:19 EDT 2008


On Mar 10, 2008, at 9:41 , Zsolt SZALAI wrote:

> It is a possibility to do something like swap "recordDef  <|>  
> recordOfDef" with "recordlikeDefs "
> where recordlikeDefs = do { reserved "record" ; others }
> but that would be the dirty way...

Er?   Refactoring the grammar like that is the clean and preferred  
way.  But if you insist, use the try combinator.

   structuredTypeDef = try recordDef <|> recordOfDef

-- 
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




More information about the Haskell-Cafe mailing list