Commit 721517e7 authored by John van Groningen's avatar John van Groningen
Browse files

refactor, rename constructor OverloadedListPatterns as OverloadedPatterns

parent 14bef518
...@@ -601,7 +601,7 @@ instance declareVars CasePatterns where ...@@ -601,7 +601,7 @@ instance declareVars CasePatterns where
= declareVars patterns dvInput = declareVars patterns dvInput
declareVars (BasicPatterns _ patterns) dvInput declareVars (BasicPatterns _ patterns) dvInput
= declareVars patterns dvInput = declareVars patterns dvInput
declareVars (OverloadedListPatterns _ decons_expr patterns) dvInput declareVars (OverloadedPatterns _ decons_expr patterns) dvInput
= declareVars patterns dvInput = declareVars patterns dvInput
instance declareVars AlgebraicPattern where instance declareVars AlgebraicPattern where
...@@ -2322,8 +2322,8 @@ instance convertCases CasePatterns where ...@@ -2322,8 +2322,8 @@ instance convertCases CasePatterns where
= convertCases patterns aliasDummyId var default_case main_dcl_module_n = convertCases patterns aliasDummyId var default_case main_dcl_module_n
convertCases (BasicPatterns _ patterns) aliasDummyId var default_case main_dcl_module_n convertCases (BasicPatterns _ patterns) aliasDummyId var default_case main_dcl_module_n
= convertCases patterns aliasDummyId var default_case main_dcl_module_n = convertCases patterns aliasDummyId var default_case main_dcl_module_n
convertCases (OverloadedListPatterns _ decons_expr patterns) aliasDummyId var default_case main_dcl_module_n convertCases (OverloadedPatterns _ decons_expr patterns) aliasDummyId var default_case main_dcl_module_n
= convertOverloadedListPatterns patterns decons_expr aliasDummyId var default_case main_dcl_module_n = convertOverloadedPatterns patterns decons_expr aliasDummyId var default_case main_dcl_module_n
// +++ other patterns ??? // +++ other patterns ???
instance convertCases [a] | convertCase a where instance convertCases [a] | convertCase a where
...@@ -2438,7 +2438,7 @@ instance convertCase BasicPattern where ...@@ -2438,7 +2438,7 @@ instance convertCase BasicPattern where
(convertRhsStrictNodeIds bp_expr) (convertRhsStrictNodeIds bp_expr)
(convertRootExpr aliasDummyId bp_expr main_dcl_module_n) (convertRootExpr aliasDummyId bp_expr main_dcl_module_n)
convertOverloadedListPatterns patterns decons_expr aliasDummyId var optionalCase main_dcl_module_n convertOverloadedPatterns patterns decons_expr aliasDummyId var optionalCase main_dcl_module_n
= sfoldr (beArgs o convertOverloadedListPattern decons_expr (localRefCounts patterns optionalCase)) = sfoldr (beArgs o convertOverloadedListPattern decons_expr (localRefCounts patterns optionalCase))
(convertDefaultCase optionalCase aliasDummyId main_dcl_module_n) patterns (convertDefaultCase optionalCase aliasDummyId main_dcl_module_n) patterns
where where
......
...@@ -130,7 +130,7 @@ instance sequence CasePatterns where ...@@ -130,7 +130,7 @@ instance sequence CasePatterns where
= sequence patterns = sequence patterns
sequence (BasicPatterns _ patterns) sequence (BasicPatterns _ patterns)
= sequence patterns = sequence patterns
sequence (OverloadedListPatterns _ decons_expr patterns) sequence (OverloadedPatterns _ decons_expr patterns)
= sequence patterns = sequence patterns
instance sequence AlgebraicPattern where instance sequence AlgebraicPattern where
......
...@@ -1127,10 +1127,10 @@ instance checkMacro CasePatterns where ...@@ -1127,10 +1127,10 @@ instance checkMacro CasePatterns where
# (patterns, ea) # (patterns, ea)
= checkMacro topLevel patterns ea = checkMacro topLevel patterns ea
= (DynamicPatterns patterns, ea) = (DynamicPatterns patterns, ea)
checkMacro topLevel (OverloadedListPatterns type decons patterns) ea checkMacro topLevel (OverloadedPatterns type decons patterns) ea
# (patterns, ea) # (patterns, ea)
= checkMacro topLevel patterns ea = checkMacro topLevel patterns ea
= (OverloadedListPatterns type decons patterns, ea) = (OverloadedPatterns type decons patterns, ea)
checkMacro _ NoPattern ea checkMacro _ NoPattern ea
= (NoPattern, ea) = (NoPattern, ea)
......
...@@ -151,19 +151,19 @@ make_case_guards cons_symbol global_type_index alg_patterns expr_heap cs ...@@ -151,19 +151,19 @@ make_case_guards cons_symbol global_type_index alg_patterns expr_heap cs
# pd_cons_index=cons_symbol.glob_object.ds_index+FirstConstructorPredefinedSymbolIndex # pd_cons_index=cons_symbol.glob_object.ds_index+FirstConstructorPredefinedSymbolIndex
| pd_cons_index==PD_UnboxedConsSymbol || pd_cons_index==PD_UnboxedNilSymbol | pd_cons_index==PD_UnboxedConsSymbol || pd_cons_index==PD_UnboxedNilSymbol
# (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs # (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs
= (OverloadedListPatterns unboxed_list decons_expr alg_patterns,expr_heap,cs) = (OverloadedPatterns unboxed_list decons_expr alg_patterns,expr_heap,cs)
| pd_cons_index==PD_UnboxedTailStrictConsSymbol || pd_cons_index==PD_UnboxedTailStrictNilSymbol | pd_cons_index==PD_UnboxedTailStrictConsSymbol || pd_cons_index==PD_UnboxedTailStrictNilSymbol
# (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs # (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs
= (OverloadedListPatterns unboxed_tail_strict_list decons_expr alg_patterns,expr_heap,cs) = (OverloadedPatterns unboxed_tail_strict_list decons_expr alg_patterns,expr_heap,cs)
| pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol | pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol
# (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs # (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs
= (OverloadedListPatterns overloaded_list decons_expr alg_patterns,expr_heap,cs) = (OverloadedPatterns overloaded_list decons_expr alg_patterns,expr_heap,cs)
| pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol | pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol
# (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs # (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs
= (OverloadedListPatterns unboxed_maybe from_just_expr alg_patterns,expr_heap,cs) = (OverloadedPatterns unboxed_maybe from_just_expr alg_patterns,expr_heap,cs)
| pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol | pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol
# (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs # (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs
= (OverloadedListPatterns overloaded_maybe from_just_expr alg_patterns,expr_heap,cs) = (OverloadedPatterns overloaded_maybe from_just_expr alg_patterns,expr_heap,cs)
= (AlgebraicPatterns global_type_index alg_patterns,expr_heap,cs) = (AlgebraicPatterns global_type_index alg_patterns,expr_heap,cs)
= (AlgebraicPatterns global_type_index alg_patterns,expr_heap,cs) = (AlgebraicPatterns global_type_index alg_patterns,expr_heap,cs)
...@@ -1015,49 +1015,49 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt ...@@ -1015,49 +1015,49 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
| pd_cons_index==PD_UnboxedConsSymbol || pd_cons_index==PD_UnboxedNilSymbol | pd_cons_index==PD_UnboxedConsSymbol || pd_cons_index==PD_UnboxedNilSymbol
# (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs # (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs
= case pattern_scheme of = case pattern_scheme of
OverloadedListPatterns (UnboxedList _ _ _) _ _ OverloadedPatterns (UnboxedList _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
-> (OverloadedListPatterns unboxed_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (OverloadedList _ _ _) _ _ OverloadedPatterns (OverloadedList _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_UnboxedConsSymbol PD_UnboxedNilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_UnboxedConsSymbol PD_UnboxedNilSymbol cs
-> (OverloadedListPatterns unboxed_list decons_expr [pattern : alg_patterns], OverloadedListPatterns unboxed_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_list decons_expr [pattern : alg_patterns], OverloadedPatterns unboxed_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
NoPattern NoPattern
-> (OverloadedListPatterns unboxed_list decons_expr [pattern], OverloadedListPatterns unboxed_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_list decons_expr [pattern], OverloadedPatterns unboxed_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
_ _
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
| pd_cons_index==PD_UnboxedTailStrictConsSymbol || pd_cons_index==PD_UnboxedTailStrictNilSymbol | pd_cons_index==PD_UnboxedTailStrictConsSymbol || pd_cons_index==PD_UnboxedTailStrictNilSymbol
# (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs # (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs
= case pattern_scheme of = case pattern_scheme of
OverloadedListPatterns (UnboxedTailStrictList _ _ _) _ _ OverloadedPatterns (UnboxedTailStrictList _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
-> (OverloadedListPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (OverloadedList _ _ _) _ _ OverloadedPatterns (OverloadedList _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol cs
-> (OverloadedListPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], OverloadedListPatterns unboxed_tail_strict_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], OverloadedPatterns unboxed_tail_strict_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
NoPattern NoPattern
-> (OverloadedListPatterns unboxed_tail_strict_list decons_expr [pattern], OverloadedListPatterns unboxed_tail_strict_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_tail_strict_list decons_expr [pattern], OverloadedPatterns unboxed_tail_strict_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
_ _
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
| pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol | pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol
= case pattern_scheme of = case pattern_scheme of
OverloadedListPatterns (OverloadedList _ _ _) _ _ OverloadedPatterns (OverloadedList _ _ _) _ _
# (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs # (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
-> (OverloadedListPatterns overloaded_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns overloaded_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (UnboxedList _ _ _) _ _ OverloadedPatterns (UnboxedList _ _ _) _ _
# (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs # (unboxed_list,decons_expr,expr_heap,cs) = make_unboxed_list expr_heap cs
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (pattern,cs) = replace_overloaded_symbol_in_pattern pattern PD_UnboxedConsSymbol PD_UnboxedNilSymbol cs # (pattern,cs) = replace_overloaded_symbol_in_pattern pattern PD_UnboxedConsSymbol PD_UnboxedNilSymbol cs
-> (OverloadedListPatterns unboxed_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (UnboxedTailStrictList _ _ _) _ _ OverloadedPatterns (UnboxedTailStrictList _ _ _) _ _
# (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs # (unboxed_tail_strict_list,decons_expr,expr_heap,cs) = make_unboxed_tail_strict_list expr_heap cs
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (pattern,cs) = replace_overloaded_symbol_in_pattern pattern PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol cs # (pattern,cs) = replace_overloaded_symbol_in_pattern pattern PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol cs
-> (OverloadedListPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_tail_strict_list decons_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
AlgebraicPatterns alg_type=:{gi_module,gi_index} _ AlgebraicPatterns alg_type=:{gi_module,gi_index} _
| gi_module==cPredefinedModuleIndex | gi_module==cPredefinedModuleIndex
| gi_index==PD_ListTypeIndex | gi_index==PD_ListTypeIndex
...@@ -1080,34 +1080,34 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt ...@@ -1080,34 +1080,34 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
NoPattern NoPattern
# (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs # (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list expr_heap cs
-> (OverloadedListPatterns overloaded_list decons_expr [pattern], OverloadedListPatterns overloaded_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns overloaded_list decons_expr [pattern], OverloadedPatterns overloaded_list decons_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
_ _
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
| pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol | pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol
# (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs # (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs
= case pattern_scheme of = case pattern_scheme of
OverloadedListPatterns (UnboxedMaybe _ _ _) _ _ OverloadedPatterns (UnboxedMaybe _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
-> (OverloadedListPatterns unboxed_maybe from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_maybe from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (OverloadedMaybe _ _ _) _ _ OverloadedPatterns (OverloadedMaybe _ _ _) _ _
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_maybe_symbols_in_patterns alg_patterns PD_UnboxedJustSymbol PD_UnboxedNothingSymbol cs # (alg_patterns,cs) = replace_overloaded_maybe_symbols_in_patterns alg_patterns PD_UnboxedJustSymbol PD_UnboxedNothingSymbol cs
-> (OverloadedListPatterns unboxed_maybe from_just_expr [pattern : alg_patterns], OverloadedListPatterns unboxed_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_maybe from_just_expr [pattern : alg_patterns], OverloadedPatterns unboxed_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
NoPattern NoPattern
-> (OverloadedListPatterns unboxed_maybe from_just_expr [pattern], OverloadedListPatterns unboxed_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_maybe from_just_expr [pattern], OverloadedPatterns unboxed_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
_ _
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
| pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol | pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol
= case pattern_scheme of = case pattern_scheme of
OverloadedListPatterns (OverloadedMaybe _ _ _) _ _ OverloadedPatterns (OverloadedMaybe _ _ _) _ _
# (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs # (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
-> (OverloadedListPatterns overloaded_maybe from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns overloaded_maybe from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (UnboxedMaybe _ _ _) _ _ OverloadedPatterns (UnboxedMaybe _ _ _) _ _
# (unboxed_list,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs # (unboxed_list,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_UnboxedJustSymbol PD_UnboxedNothingSymbol cs # (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_UnboxedJustSymbol PD_UnboxedNothingSymbol cs
-> (OverloadedListPatterns unboxed_list from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns unboxed_list from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
AlgebraicPatterns alg_type=:{gi_module,gi_index} _ AlgebraicPatterns alg_type=:{gi_module,gi_index} _
| gi_module==cPredefinedModuleIndex | gi_module==cPredefinedModuleIndex
| gi_index==PD_MaybeTypeIndex | gi_index==PD_MaybeTypeIndex
...@@ -1122,7 +1122,7 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt ...@@ -1122,7 +1122,7 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
NoPattern NoPattern
# (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs # (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs
-> (OverloadedListPatterns overloaded_maybe from_just_expr [pattern], OverloadedListPatterns overloaded_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (OverloadedPatterns overloaded_maybe from_just_expr [pattern], OverloadedPatterns overloaded_maybe from_just_expr [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
_ _
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
= case pattern_scheme of = case pattern_scheme of
...@@ -1132,22 +1132,22 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt ...@@ -1132,22 +1132,22 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
-> (AlgebraicPatterns global_type_index [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (AlgebraicPatterns global_type_index [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
# cs & cs_error = checkErrorWithOptionalPosition cons_symbol.glob_object.ds_ident pos "incompatible types of patterns" cs.cs_error # cs & cs_error = checkErrorWithOptionalPosition cons_symbol.glob_object.ds_ident pos "incompatible types of patterns" cs.cs_error
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedListPatterns (OverloadedList _ _ _) _ _ OverloadedPatterns (OverloadedList _ _ _) _ _
| global_type_index.gi_module==cPredefinedModuleIndex | global_type_index.gi_module==cPredefinedModuleIndex
| global_type_index.gi_index==PD_ListTypeIndex | global_type_index.gi_index==PD_ListTypeIndex
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_ConsSymbol PD_NilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_ConsSymbol PD_NilSymbol cs
-> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
| global_type_index.gi_index==PD_StrictListTypeIndex | global_type_index.gi_index==PD_StrictListTypeIndex
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_StrictConsSymbol PD_StrictNilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_StrictConsSymbol PD_StrictNilSymbol cs
-> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
| global_type_index.gi_index==PD_TailStrictListTypeIndex | global_type_index.gi_index==PD_TailStrictListTypeIndex
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_TailStrictConsSymbol PD_TailStrictNilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_TailStrictConsSymbol PD_TailStrictNilSymbol cs
-> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
| global_type_index.gi_index==PD_StrictTailStrictListTypeIndex | global_type_index.gi_index==PD_StrictTailStrictListTypeIndex
# alg_patterns = alg_patterns_of_OverloadedListPatterns_or_NoPattern patterns # alg_patterns = alg_patterns_of_OverloadedPatterns_or_NoPattern patterns
# (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_StrictTailStrictConsSymbol PD_StrictTailStrictNilSymbol cs # (alg_patterns,cs) = replace_overloaded_symbols_in_patterns alg_patterns PD_StrictTailStrictConsSymbol PD_StrictTailStrictNilSymbol cs
-> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs) -> (AlgebraicPatterns global_type_index [pattern:alg_patterns], AlgebraicPatterns global_type_index [], pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
-> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs) -> (patterns, pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics,illegal_combination_of_patterns_error cons_symbol cs)
...@@ -1170,8 +1170,8 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt ...@@ -1170,8 +1170,8 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
alg_patterns_of_AlgebraicPatterns_or_NoPattern (AlgebraicPatterns _ alg_patterns) = alg_patterns alg_patterns_of_AlgebraicPatterns_or_NoPattern (AlgebraicPatterns _ alg_patterns) = alg_patterns
alg_patterns_of_AlgebraicPatterns_or_NoPattern NoPattern = [] alg_patterns_of_AlgebraicPatterns_or_NoPattern NoPattern = []
alg_patterns_of_OverloadedListPatterns_or_NoPattern (OverloadedListPatterns _ _ alg_patterns) = alg_patterns alg_patterns_of_OverloadedPatterns_or_NoPattern (OverloadedPatterns _ _ alg_patterns) = alg_patterns
alg_patterns_of_OverloadedListPatterns_or_NoPattern NoPattern = [] alg_patterns_of_OverloadedPatterns_or_NoPattern NoPattern = []
illegal_combination_of_patterns_error cons_symbol cs illegal_combination_of_patterns_error cons_symbol cs
= { cs & cs_error = checkError cons_symbol.glob_object.ds_ident "illegal combination of patterns" cs.cs_error } = { cs & cs_error = checkError cons_symbol.glob_object.ds_ident "illegal combination of patterns" cs.cs_error }
......
...@@ -688,14 +688,14 @@ instance consumerRequirements Case where ...@@ -688,14 +688,14 @@ instance consumerRequirements Case where
= (combineClasses ccgs ccd, not safe, ai) = (combineClasses ccgs ccd, not safe, ai)
where where
handle_overloaded_list_patterns handle_overloaded_list_patterns
(OverloadedListPatterns (OverloadedList _ _ _) decons_expr=:(App {app_symb={symb_kind=SK_Function _},app_args=[app_arg]}) patterns) (OverloadedPatterns (OverloadedList _ _ _) decons_expr=:(App {app_symb={symb_kind=SK_Function _},app_args=[app_arg]}) patterns)
ai ai
// decons_expr will be optimized to a decons_u Selector in transform // decons_expr will be optimized to a decons_u Selector in transform
# (cc, _, ai) = consumerRequirements app_arg ro ai # (cc, _, ai) = consumerRequirements app_arg ro ai
# ai = aiUnifyClassifications CActive cc ai # ai = aiUnifyClassifications CActive cc ai
= ai = ai
handle_overloaded_list_patterns handle_overloaded_list_patterns
(OverloadedListPatterns _ decons_expr _) ai (OverloadedPatterns _ decons_expr _) ai
# (_,_,ai) = consumerRequirements decons_expr ro ai # (_,_,ai) = consumerRequirements decons_expr ro ai
= ai = ai
handle_overloaded_list_patterns handle_overloaded_list_patterns
...@@ -721,7 +721,7 @@ instance consumerRequirements Case where ...@@ -721,7 +721,7 @@ instance consumerRequirements Case where
= (appearance_loop all_sorted_constructors constructors_and_unsafe_bits, not (multimatch_loop has_default constructors_and_unsafe_bits)) = (appearance_loop all_sorted_constructors constructors_and_unsafe_bits, not (multimatch_loop has_default constructors_and_unsafe_bits))
inspect_patterns common_defs has_default (BasicPatterns BT_Bool _) constructors_and_unsafe_bits inspect_patterns common_defs has_default (BasicPatterns BT_Bool _) constructors_and_unsafe_bits
= (appearance_loop [0,1] constructors_and_unsafe_bits, not (multimatch_loop has_default constructors_and_unsafe_bits)) = (appearance_loop [0,1] constructors_and_unsafe_bits, not (multimatch_loop has_default constructors_and_unsafe_bits))
inspect_patterns common_defs has_default (OverloadedListPatterns _ _ _) constructors_and_unsafe_bits inspect_patterns common_defs has_default (OverloadedPatterns _ _ _) constructors_and_unsafe_bits
= (check_n_safe_pattern_constructors constructors_and_unsafe_bits 2, not (multimatch_loop has_default constructors_and_unsafe_bits)) = (check_n_safe_pattern_constructors constructors_and_unsafe_bits 2, not (multimatch_loop has_default constructors_and_unsafe_bits))
inspect_patterns _ _ _ _ inspect_patterns _ _ _ _
= (False, False) = (False, False)
...@@ -788,7 +788,7 @@ where ...@@ -788,7 +788,7 @@ where
-> True -> True
// BasicPatterns (BT_String _) basic_patterns) // BasicPatterns (BT_String _) basic_patterns)
// -> [ string \\ {bp_value=BVS string}<-basic_patterns ] ---> ("BasicPatterns String") // -> [ string \\ {bp_value=BVS string}<-basic_patterns ] ---> ("BasicPatterns String")
OverloadedListPatterns overloaded_list _ algebraic_patterns OverloadedPatterns overloaded_list _ algebraic_patterns
-> True -> True
_ _
-> False -> False
...@@ -803,7 +803,7 @@ where ...@@ -803,7 +803,7 @@ where
-> [int \\ {bp_value=BVInt int}<-basic_patterns ] -> [int \\ {bp_value=BVInt int}<-basic_patterns ]
// BasicPatterns (BT_String _) basic_patterns // BasicPatterns (BT_String _) basic_patterns
// -> [string \\ {bp_value=BVS string}<-basic_patterns] // -> [string \\ {bp_value=BVS string}<-basic_patterns]
OverloadedListPatterns overloaded_list _ algebraic_patterns OverloadedPatterns overloaded_list _ algebraic_patterns
-> [glob_object.ds_index \\ {ap_symbol={glob_object}}<-algebraic_patterns] -> [glob_object.ds_index \\ {ap_symbol={glob_object}}<-algebraic_patterns]
sort constr_indices pattern_exprs sort constr_indices pattern_exprs
...@@ -825,7 +825,7 @@ get_pattern_exprs_and_bind_pattern_vars (AlgebraicPatterns type patterns) ai ...@@ -825,7 +825,7 @@ get_pattern_exprs_and_bind_pattern_vars (AlgebraicPatterns type patterns) ai
get_pattern_exprs_and_bind_pattern_vars (BasicPatterns type patterns) ai get_pattern_exprs_and_bind_pattern_vars (BasicPatterns type patterns) ai
# pattern_exprs = [bp_expr \\ {bp_expr}<-patterns] # pattern_exprs = [bp_expr \\ {bp_expr}<-patterns]
= (pattern_exprs,ai) = (pattern_exprs,ai)
get_pattern_exprs_and_bind_pattern_vars (OverloadedListPatterns type _ patterns) ai get_pattern_exprs_and_bind_pattern_vars (OverloadedPatterns type _ patterns) ai
# pattern_exprs = [ap_expr \\ {ap_expr}<-patterns] # pattern_exprs = [ap_expr \\ {ap_expr}<-patterns]
pattern_vars = flatten [ ap_vars \\ {ap_vars}<-patterns] pattern_vars = flatten [ ap_vars \\ {ap_vars}<-patterns]
(ai_next_var, ai_next_var_of_fun, ai_var_heap) (ai_next_var, ai_next_var_of_fun, ai_var_heap)
...@@ -1407,7 +1407,7 @@ where ...@@ -1407,7 +1407,7 @@ where
get_linearity_info cc_linear_bits (AlgebraicPatterns _ algebraic_patterns) var_heap get_linearity_info cc_linear_bits (AlgebraicPatterns _ algebraic_patterns) var_heap
= get_linearity_info_of_patterns cc_linear_bits algebraic_patterns var_heap = get_linearity_info_of_patterns cc_linear_bits algebraic_patterns var_heap
get_linearity_info cc_linear_bits (OverloadedListPatterns _ _ algebraic_patterns) var_heap get_linearity_info cc_linear_bits (OverloadedPatterns _ _ algebraic_patterns) var_heap
= get_linearity_info_of_patterns cc_linear_bits algebraic_patterns var_heap = get_linearity_info_of_patterns cc_linear_bits algebraic_patterns var_heap
get_linearity_info cc_linear_bits _ var_heap get_linearity_info cc_linear_bits _ var_heap
= ([!!], var_heap) = ([!!], var_heap)
...@@ -1536,7 +1536,7 @@ count_case_locals (AlgebraicPatterns _ patterns) n ...@@ -1536,7 +1536,7 @@ count_case_locals (AlgebraicPatterns _ patterns) n
count_case_locals (BasicPatterns _ patterns) n count_case_locals (BasicPatterns _ patterns) n
# pattern_exprs = [ bp_expr \\ {bp_expr} <- patterns ] # pattern_exprs = [ bp_expr \\ {bp_expr} <- patterns ]
= foldSt count_locals pattern_exprs n = foldSt count_locals pattern_exprs n
count_case_locals (OverloadedListPatterns _ _ patterns) n count_case_locals (OverloadedPatterns _ _ patterns) n
# pattern_exprs = [ ap_expr \\ {ap_expr} <- patterns ] # pattern_exprs = [ ap_expr \\ {ap_expr} <- patterns ]
pattern_vars = flatten [ ap_vars \\ {ap_vars} <- patterns ] pattern_vars = flatten [ ap_vars \\ {ap_vars} <- patterns ]
= foldSt count_locals pattern_exprs (foldSt count_case_guard_locals pattern_vars n) = foldSt count_locals pattern_exprs (foldSt count_case_guard_locals pattern_vars n)
...@@ -1836,7 +1836,7 @@ instance producerRequirements CasePatterns where ...@@ -1836,7 +1836,7 @@ instance producerRequirements CasePatterns where
= producerRequirements patterns prs = producerRequirements patterns prs
producerRequirements (BasicPatterns type patterns) prs producerRequirements (BasicPatterns type patterns) prs
= producerRequirements patterns prs = producerRequirements patterns prs
producerRequirements (OverloadedListPatterns _ _ patterns) prs producerRequirements (OverloadedPatterns _ _ patterns) prs
= producerRequirements patterns prs = producerRequirements patterns prs
producerRequirements (DynamicPatterns patterns) prs producerRequirements (DynamicPatterns patterns) prs
//...disallow for now... //...disallow for now...
......
...@@ -1406,7 +1406,7 @@ instance e_corresponds CasePatterns where ...@@ -1406,7 +1406,7 @@ instance e_corresponds CasePatterns where
o` e_corresponds dcl_patterns icl_patterns o` e_corresponds dcl_patterns icl_patterns
e_corresponds (NewTypePatterns _ dcl_patterns) (NewTypePatterns _ icl_patterns) e_corresponds (NewTypePatterns _ dcl_patterns) (NewTypePatterns _ icl_patterns)
= e_corresponds dcl_patterns icl_patterns = e_corresponds dcl_patterns icl_patterns
e_corresponds (OverloadedListPatterns dcl_alg_type _ dcl_patterns) (OverloadedListPatterns icl_alg_type _ icl_patterns) e_corresponds (OverloadedPatterns dcl_alg_type _ dcl_patterns) (OverloadedPatterns icl_alg_type _ icl_patterns)
= e_corresponds dcl_patterns icl_patterns = e_corresponds dcl_patterns icl_patterns
e_corresponds (DynamicPatterns dcl_patterns) (DynamicPatterns icl_patterns) e_corresponds (DynamicPatterns dcl_patterns) (DynamicPatterns icl_patterns)
= e_corresponds dcl_patterns icl_patterns = e_corresponds dcl_patterns icl_patterns
......
...@@ -348,9 +348,9 @@ instance convertDynamics CasePatterns where ...@@ -348,9 +348,9 @@ instance convertDynamics CasePatterns where
convertDynamics cinp (AlgebraicPatterns type alts) ci convertDynamics cinp (AlgebraicPatterns type alts) ci
# (alts, ci) = convertDynamics cinp alts ci # (alts, ci) = convertDynamics cinp alts ci
= (AlgebraicPatterns type alts, ci) = (AlgebraicPatterns type alts, ci)
convertDynamics cinp (OverloadedListPatterns type decons alts) ci convertDynamics cinp (OverloadedPatterns type decons alts) ci
# (alts, ci) = convertDynamics cinp alts ci # (alts, ci) = convertDynamics cinp alts ci
= (OverloadedListPatterns type decons alts, ci) = (OverloadedPatterns type decons alts, ci)
convertDynamic cinp=:{cinp_dynamic_representation={dr_type_ident}} convertDynamic cinp=:{cinp_dynamic_representation={dr_type_ident}}
{dyn_expr, dyn_type_code} ci {dyn_expr, dyn_type_code} ci
......
...@@ -322,7 +322,7 @@ where ...@@ -322,7 +322,7 @@ where
same_length [_:l1] [_:l2] = same_length l1 l2 same_length [_:l1] [_:l2] = same_length l1 l2
same_length [] [] = False same_length [] [] = False
same_length _ _ = True same_length _ _ = True
all_constructors_matched (OverloadedListPatterns _ _ [_,_]) common_defs all_constructors_matched (OverloadedPatterns _ _ [_,_]) common_defs
= True = True
all_constructors_matched case_guards common_defs all_constructors_matched case_guards common_defs
= False = False
...@@ -475,7 +475,7 @@ weightedRefCountOfCase rci=:{rci_depth,rci_imported,rci_has_default} {case_expr, ...@@ -475,7 +475,7 @@ weightedRefCountOfCase rci=:{rci_depth,rci_imported,rci_has_default} {case_expr,
= mapSt (weighted_ref_count_in_algebraic_pattern rci) patterns ([], No, collected_imports, var_heap, expr_heap) = mapSt (weighted_ref_count_in_algebraic_pattern rci) patterns ([], No, collected_imports, var_heap, expr_heap)
weighted_ref_count_in_case_patterns rci (BasicPatterns type patterns) collected_imports var_heap expr_heap weighted_ref_count_in_case_patterns rci (BasicPatterns type patterns) collected_imports var_heap expr_heap
= mapSt (\{bp_expr} -> weightedRefCountAddPatternExpr rci bp_expr) patterns ([], No, collected_imports, var_heap, expr_heap) = mapSt (\{bp_expr} -> weightedRefCountAddPatternExpr rci bp_expr) patterns ([], No, collected_imports, var_heap, expr_heap)
weighted_ref_count_in_case_patterns rci (OverloadedListPatterns type _ patterns) collected_imports var_heap expr_heap weighted_ref_count_in_case_patterns rci (OverloadedPatterns type _ patterns) collected_imports var_heap expr_heap
= mapSt (weighted_ref_count_in_algebraic_pattern rci) patterns ([], No, collected_imports, var_heap, expr_heap) = mapSt (weighted_ref_count_in_algebraic_pattern rci) patterns ([], No, collected_imports, var_heap, expr_heap)
weighted_ref_count_in_case_patterns rci (DynamicPatterns patterns) collected_imports var_heap expr_heap weighted_ref_count_in_case_patterns rci (DynamicPatterns patterns) collected_imports var_heap expr_heap
= mapSt (\{dp_rhs} -> weightedRefCountAddPatternExpr rci dp_rhs) patterns ([], No, collected_imports, var_heap, expr_heap) = mapSt (\{dp_rhs} -> weightedRefCountAddPatternExpr rci