Commit b8ce1eef authored by John van Groningen's avatar John van Groningen

add <|- generator for overloaded lists again

parent 7f939dcc
......@@ -2665,16 +2665,14 @@ where
(lhs_expr, pState) = wantExpression cIsAPattern pState
(token, pState) = nextToken FunctionContext pState
| token == LeftArrowToken
//MW3 was: = want_generators IsListGenerator (toLineAndColumn qual_position) lhs_expr pState
= want_generators IsListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
| token == LeftArrowColonToken
//MW3 was: = want_generators IsArrayGenerator (toLineAndColumn qual_position) lhs_expr pState
= want_generators IsArrayGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
| token == LeftArrowWithBarToken
= want_generators IsOverloadedListGenerator (toLineAndColumn qual_position) qual_filename lhs_expr pState
= ({qual_generators = [], qual_filter = No, qual_position = {lc_line = 0, lc_column = 0}, qual_filename = "" },
parseError "comprehension: qualifier" (Yes token) "qualifier(s)" pState)
//MW3 was: want_generators :: !GeneratorKind !LineAndColumn !ParsedExpr !ParseState -> (!Qualifier, !ParseState)
//MW3 was: want_generators gen_kind qual_position pattern_exp pState
want_generators :: !GeneratorKind !LineAndColumn !FileName !ParsedExpr !ParseState -> (!Qualifier, !ParseState)
want_generators gen_kind qual_position qual_filename pattern_exp pState
# (gen_position, pState) = getPosition pState
......
......@@ -1055,10 +1055,7 @@ cNonUniqueSelection :== False
| PS_Array !ParsedExpr
| PS_Erroneous
:: GeneratorKind :== Bool
IsListGenerator :== True
IsArrayGenerator :== False
:: GeneratorKind = IsListGenerator | IsOverloadedListGenerator | IsArrayGenerator
:: LineAndColumn = {lc_line :: !Int, lc_column :: !Int}
......
......@@ -1050,11 +1050,7 @@ cNonUniqueSelection :== False
| PS_Array !ParsedExpr
| PS_Erroneous
:: GeneratorKind :== Bool
IsListGenerator :== True
IsArrayGenerator :== False
:: GeneratorKind = IsListGenerator | IsOverloadedListGenerator | IsArrayGenerator
:: LineAndColumn = {lc_line :: !Int, lc_column :: !Int}
......@@ -1524,7 +1520,11 @@ where
instance <<< Generator
where
(<<<) file {gen_kind,gen_pattern,gen_expr}
= file <<< gen_pattern <<< (if gen_kind "<-" "<-:") <<< gen_expr
= file <<< gen_pattern <<< (gen_kind_to_string gen_kind) <<< gen_expr
where
gen_kind_to_string IsListGenerator = "<-"
gen_kind_to_string IsOverloadedListGenerator = "<|-"
gen_kind_to_string IsArrayGenerator = "<-:"
instance <<< BasicValue
where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment