*** ./HsParser.ly Thu Sep 10 13:55:10 1998 --- ../.././HsParser.ly Tue Sep 14 11:54:47 1999 *************** *** 107,112 **** --- 107,113 ---- > 'module' { KW_Module } > 'newtype' { KW_NewType } > 'of' { KW_Of } + > 'receive' { KW_Receive } > 'then' { KW_Then } > 'type' { KW_Type } > 'where' { KW_Where } *************** *** 488,493 **** --- 489,495 ---- > | 'let' decllist 'in' exp { HsLet $2 $4 } > | 'if' exp 'then' exp 'else' exp { HsIf $2 $4 $6 } > | 'case' exp 'of' altslist { HsCase $2 $4 } + > | 'receive' altslist { HsReceive $2 } > | '-' fexp { HsNegApp $2 } > | 'do' stmtlist { HsDo $2 } > | fexp { $1 } *** ./HsSyn.lhs Thu Sep 10 13:27:57 1998 --- ../.././HsSyn.lhs Thu Sep 9 12:05:53 1999 *************** *** 133,138 **** --- 133,139 ---- > | HsLet [HsDecl] HsExp > | HsIf HsExp HsExp HsExp > | HsCase HsExp [HsAlt] + > | HsReceive [HsAlt] > | HsDo [HsStmt] > | HsTuple [HsExp] > | HsList [HsExp] *** ./Lexer.lhs Fri Jul 31 12:02:38 1998 --- ../.././Lexer.lhs Fri Sep 10 11:46:05 1999 *************** *** 82,87 **** --- 82,88 ---- > | KW_Module > | KW_NewType > | KW_Of + > | KW_Receive > | KW_Then > | KW_Type > | KW_Where *************** *** 126,131 **** --- 127,133 ---- > ( "module", KW_Module ), > ( "newtype", KW_NewType ), > ( "of", KW_Of ), + > ( "receive", KW_Receive ), > ( "then", KW_Then ), > ( "type", KW_Type ), > ( "where", KW_Where ), *** ./ParseUtils.lhs Wed Jul 29 16:56:14 1998 --- ../.././ParseUtils.lhs Fri Sep 10 12:15:21 1999 *************** *** 137,142 **** --- 137,144 ---- > HsCase e alts -> mapP checkAlt alts `thenP` \alts -> > checkExpr e `thenP` \e -> > returnP (HsCase e alts) + > HsReceive alts -> mapP checkAlt alts `thenP` \alts -> + > returnP (HsReceive alts) > HsDo stmts -> mapP checkStmt stmts `thenP` (returnP . HsDo) > HsTuple es -> checkManyExprs es HsTuple > HsList es -> checkManyExprs es HsList *** ./HsPretty.hs Thu Sep 10 14:04:51 1998 --- ../.././HsPretty.hs Tue Sep 14 11:48:52 1999 *************** *** 223,228 **** --- 223,232 ---- text "else", ppHsExp elsexp] ppHsExp (HsCase cond altList) = myFsep[text "case", ppHsExp cond, text "of"] $$$ body caseIndent (map ppHsAlt altList) + ppHsExp (HsReceive altList) = myFsep[text "receive (\\neueV -> case neueV of"] + $$$ body caseIndent (map ppRcvHsAlt altList) + $$$ text ")" + ppHsExp (HsDo stmtList) = text "do" $$$ body doIndent (map ppHsStmt stmtList) -- Constructors & Vars ppHsExp (HsVar name) = ppHsNameParen name *************** *** 296,301 **** --- 300,316 ---- ppGAlt (HsGuardedAlt pos exp body) = myFsep [char '|', ppHsExp exp, text "->", ppHsExp body] + ------------------------- Receive bodies ------------------------- + ppRcvHsAlt :: HsAlt -> Doc + ppRcvHsAlt (HsAlt pos exp gAlts decls) = + ppHsPat exp <+> ppRcvGAlts gAlts $$$ ppWhere decls + + ppRcvGAlts :: HsGuardedAlts -> Doc + ppRcvGAlts (HsUnGuardedAlt exp) = text "-> Just $" <+> ppHsExp exp + ppRcvGAlts (HsGuardedAlts altList) = myVcat . map ppRcvGAlt $ altList + + ppRcvGAlt (HsGuardedAlt pos exp body) = + myFsep [char '|', ppHsExp exp, text "-> Just $", ppHsExp body] ------------------------- Statements in monads & list comprehensions ----- ppHsStmt :: HsStmt -> Doc