Commit ee9ae66b authored by John van Groningen's avatar John van Groningen
Browse files

refactor, rename nothing to none in frontend modules

parent 9fa28186
......@@ -293,7 +293,7 @@ BETupleSymb:==7;
BEConsSymb:==8;
BEJustSymb:==9;
BENilSymb:==10;
BENothingSymb:==11;
BENoneSymb:==11;
BEApplySymb:==12;
BEIfSymb:==13;
BEFailSymb:==14;
......
......@@ -773,7 +773,7 @@ BETupleSymb:==7;
BEConsSymb:==8;
BEJustSymb:==9;
BENilSymb:==10;
BENothingSymb:==11;
BENoneSymb:==11;
BEApplySymb:==12;
BEIfSymb:==13;
BEFailSymb:==14;
......
......@@ -1195,10 +1195,10 @@ predefineSymbols {dcl_common} predefs
maybe_constructors :: [(Int,BESymbKind,Int)]
maybe_constructors
= [ (PD_NothingSymbol, BENothingSymb,0),
(PD_StrictNothingSymbol, BENothingSymb,2),
(PD_UnboxedNothingSymbol, BENothingSymb,4/*3*/),
(PD_OverloadedNothingSymbol, BENothingSymb,0),
= [ (PD_NoneSymbol, BENoneSymb,0),
(PD_StrictNoneSymbol, BENoneSymb,2),
(PD_UnboxedNoneSymbol, BENoneSymb,4/*3*/),
(PD_OverloadedNoneSymbol, BENoneSymb,0),
(PD_JustSymbol, BEJustSymb,0),
(PD_StrictJustSymbol, BEJustSymb,2),
(PD_UnboxedJustSymbol, BEJustSymb,3),
......@@ -1333,9 +1333,9 @@ adjustStrictMaybeFunctions maybe_unboxed_first_instance_indices predefs dcls use
= backEnd
# std_strict_maybes_instances=std_strict_maybes.dcl_common.com_instance_defs
# backEnd = adjust_strict_maybe_instances 0 std_strict_maybes_instances backEnd
# std_strict_maybes_nothing_functions=std_strict_maybes.dcl_functions
# std_strict_maybes_none_functions=std_strict_maybes.dcl_functions
# first_instance_index=std_strict_maybes.dcl_instances.ir_from;
# backEnd=adjust_overloaded_nothing_functions 0 first_instance_index std_strict_maybes_nothing_functions backEnd
# backEnd=adjust_overloaded_none_functions 0 first_instance_index std_strict_maybes_none_functions backEnd
# std_maybe_common_defs = std_strict_maybes.dcl_common
indexUMaybeClass = predefs.[PD_UMaybeClass].pds_def
......@@ -1371,10 +1371,10 @@ where
= adjust_strict_maybe_members (i+1) members backEnd
= backEnd
adjust_overloaded_nothing_functions function_index first_instance_index std_strict_maybes_nothing_functions backEnd
adjust_overloaded_none_functions function_index first_instance_index std_strict_maybes_none_functions backEnd
| function_index<first_instance_index
# backEnd = appBackEnd (BEAdjustOverloadedNothingFunction function_index std_strict_maybes_module_index) backEnd
= adjust_overloaded_nothing_functions (function_index+1) first_instance_index std_strict_maybes_nothing_functions backEnd
= adjust_overloaded_none_functions (function_index+1) first_instance_index std_strict_maybes_none_functions backEnd
= backEnd
adjustRecordMaybeInstances [] rt_fields backend
......
......@@ -3865,8 +3865,8 @@ where
<=< adjustPredefSymbol PD_just mod_index STE_Member
<=< adjustPredefSymbol PD_from_just_u mod_index STE_Member
<=< adjustPredefSymbol PD_from_just mod_index STE_Member
<=< adjustPredefSymbol PD_nothing_u mod_index STE_DclFunction
<=< adjustPredefSymbol PD_nothing mod_index STE_DclFunction
<=< adjustPredefSymbol PD_none_u mod_index STE_DclFunction
<=< adjustPredefSymbol PD_none mod_index STE_DclFunction
<=< adjust_predef_symbols PD_MaybeClass PD_UMaybeClass mod_index STE_Class
| mod_index==cs_predef_symbols.[PD_StdDynamic].pds_def
= cs
......
......@@ -133,35 +133,35 @@ make_overloaded_list expr_heap cs
get_unboxed_maybe_indices_and_from_just_u_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_unboxed_maybe_indices_and_from_just_u_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictMaybes_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictMaybes].pds_def
(nothing_u_index,cs_predef_symbols)=cs_predef_symbols![PD_nothing_u].pds_def
(none_u_index,cs_predef_symbols)=cs_predef_symbols![PD_none_u].pds_def
(from_just_u_index,cs_predef_symbols)=cs_predef_symbols![PD_from_just_u].pds_def
from_just_u_ident = predefined_idents.[PD_from_just_u]
app_symb = {symb_ident=from_just_u_ident,symb_kind=SK_OverloadedFunction {glob_object=from_just_u_index,glob_module=stdStrictMaybes_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictMaybes}
= (stdStrictMaybes_index,from_just_u_index,nothing_u_index,app_symb,cs)
= (stdStrictMaybes_index,from_just_u_index,none_u_index,app_symb,cs)
make_unboxed_maybe expr_heap cs
# (stdStrictMaybes_index,from_just_u_index,nothing_u_index,app_symb,cs) = get_unboxed_maybe_indices_and_from_just_u_symb_ident cs
# (stdStrictMaybes_index,from_just_u_index,none_u_index,app_symb,cs) = get_unboxed_maybe_indices_and_from_just_u_symb_ident cs
# (new_info_ptr,expr_heap) = newPtr EI_Empty expr_heap
# decons_expr = App {app_symb=app_symb,app_args=[],app_info_ptr=new_info_ptr}
# unboxed_maybe=UnboxedMaybe stdStrictMaybes_index from_just_u_index nothing_u_index
# unboxed_maybe=UnboxedMaybe stdStrictMaybes_index from_just_u_index none_u_index
= (unboxed_maybe,decons_expr,expr_heap,cs)
get_overloaded_maybe_indices_and_from_just_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_overloaded_maybe_indices_and_from_just_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictMaybes_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictMaybes].pds_def
(nothing_index,cs_predef_symbols)=cs_predef_symbols![PD_nothing].pds_def
(none_index,cs_predef_symbols)=cs_predef_symbols![PD_none].pds_def
(from_just_index,cs_predef_symbols)=cs_predef_symbols![PD_from_just].pds_def
from_just_ident = predefined_idents.[PD_from_just]
app_symb = {symb_ident=from_just_ident,symb_kind=SK_OverloadedFunction {glob_object=from_just_index,glob_module=stdStrictMaybes_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictMaybes}
= (stdStrictMaybes_index,from_just_index,nothing_index,app_symb,cs)
= (stdStrictMaybes_index,from_just_index,none_index,app_symb,cs)
make_overloaded_maybe expr_heap cs
# (stdStrictMaybes_index,from_just_index,nothing_index,app_symb,cs) = get_overloaded_maybe_indices_and_from_just_symb_ident cs
# (stdStrictMaybes_index,from_just_index,none_index,app_symb,cs) = get_overloaded_maybe_indices_and_from_just_symb_ident cs
(new_info_ptr,expr_heap) = newPtr EI_Empty expr_heap
decons_expr = App {app_symb=app_symb,app_args=[],app_info_ptr=new_info_ptr}
overloaded_list=OverloadedMaybe stdStrictMaybes_index from_just_index nothing_index
overloaded_list=OverloadedMaybe stdStrictMaybes_index from_just_index none_index
= (overloaded_list,decons_expr,expr_heap,cs)
make_case_guards cons_symbol global_type_index alg_patterns expr_heap cs
......@@ -176,10 +176,10 @@ make_case_guards cons_symbol global_type_index alg_patterns expr_heap cs
| pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol
# (overloaded_list,decons_expr,expr_heap,cs) = make_overloaded_list 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_UnboxedNoneSymbol
# (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe 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_OverloadedNoneSymbol
# (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs
= (OverloadedPatterns overloaded_maybe from_just_expr alg_patterns,expr_heap,cs)
= (AlgebraicPatterns global_type_index alg_patterns,expr_heap,cs)
......@@ -1004,8 +1004,8 @@ where
| pd_cons_index==PD_UnboxedConsSymbol || pd_cons_index==PD_UnboxedNilSymbol ||
pd_cons_index==PD_UnboxedTailStrictConsSymbol || pd_cons_index==PD_UnboxedTailStrictNilSymbol ||
pd_cons_index==PD_OverloadedConsSymbol || pd_cons_index==PD_OverloadedNilSymbol ||
pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol ||
pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol
pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNoneSymbol ||
pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNoneSymbol
= False
= all_wild_card_args args
= all_wild_card_args args
......@@ -1101,7 +1101,7 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
-> (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)
| pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNothingSymbol
| pd_cons_index==PD_UnboxedJustSymbol || pd_cons_index==PD_UnboxedNoneSymbol
# (unboxed_maybe,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs
= case pattern_scheme of
OverloadedPatterns (UnboxedMaybe _ _ _) _ _
......@@ -1109,13 +1109,13 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
-> (OverloadedPatterns unboxed_maybe from_just_expr [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
OverloadedPatterns (OverloadedMaybe _ _ _) _ _
# 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_UnboxedNoneSymbol 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
-> (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)
| pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNothingSymbol
| pd_cons_index==PD_OverloadedJustSymbol || pd_cons_index==PD_OverloadedNoneSymbol
= case pattern_scheme of
OverloadedPatterns (OverloadedMaybe _ _ _) _ _
# (overloaded_maybe,from_just_expr,expr_heap,cs) = make_overloaded_maybe expr_heap cs
......@@ -1124,17 +1124,17 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
OverloadedPatterns (UnboxedMaybe _ _ _) _ _
# (unboxed_list,from_just_expr,expr_heap,cs) = make_unboxed_maybe expr_heap cs
# 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_UnboxedNoneSymbol 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} _
| gi_module==cPredefinedModuleIndex
| gi_index==PD_MaybeTypeIndex
# alg_patterns = alg_patterns_of_AlgebraicPatterns_or_NoPattern patterns
# (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_JustSymbol PD_NothingSymbol cs
# (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_JustSymbol PD_NoneSymbol cs
-> (AlgebraicPatterns alg_type [pattern : alg_patterns], pattern_scheme, pattern_variables, defaul, var_store, expr_heap, opt_dynamics, cs)
| gi_index==PD_StrictMaybeTypeIndex
# alg_patterns = alg_patterns_of_AlgebraicPatterns_or_NoPattern patterns
# (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_StrictJustSymbol PD_StrictNothingSymbol cs
# (pattern,cs) = replace_overloaded_maybe_symbol_in_pattern pattern PD_StrictJustSymbol PD_StrictNoneSymbol cs
-> (AlgebraicPatterns alg_type [pattern : alg_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,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)
......@@ -1231,7 +1231,7 @@ transform_pattern (AP_Algebraic cons_symbol global_type_index args opt_var) patt
# pds_ident = predefined_idents.[pd_cons_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
= ({pattern & ap_symbol.glob_object=glob_object},cs)
| index==PD_OverloadedNothingSymbol
| index==PD_OverloadedNoneSymbol
# ({pds_def},cs) = cs!cs_predef_symbols.[pd_nil_symbol]
# pds_ident = predefined_idents.[pd_nil_symbol]
# glob_object = {glob_object & ds_index=pds_def,ds_ident=pds_ident}
......@@ -1455,7 +1455,7 @@ where
// instead report that StdStrictLists should be imported in function check_needed_modules_are_imported
| id==local_predefined_idents.[PD_just] || id==local_predefined_idents.[PD_from_just]
|| id==local_predefined_idents.[PD_just_u] || id==local_predefined_idents.[PD_from_just_u]
|| id==local_predefined_idents.[PD_nothing] || id==local_predefined_idents.[PD_nothing_u]
|| id==local_predefined_idents.[PD_none] || id==local_predefined_idents.[PD_none_u]
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cNeedStdStrictMaybes}})
// instead report that cNeedStdStrictMaybes should be imported in function check_needed_modules_are_imported
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "undefined" cs_error })
......
......@@ -1284,13 +1284,13 @@ make_unboxed_tail_strict_list expr_heap predef_symbols
make_unboxed_maybe :: !*ExpressionHeap !PredefinedSymbols -> (!OverloadedPatternType,!Expression,!*ExpressionHeap)
make_unboxed_maybe expr_heap predef_symbols
# stdStrictMaybes_index = predef_symbols.[PD_StdStrictMaybes].pds_def
nothing_u_index = predef_symbols.[PD_nothing_u].pds_def
none_u_index = predef_symbols.[PD_none_u].pds_def
from_just_u_index = predef_symbols.[PD_from_just_u].pds_def
from_just_u_ident = predefined_idents.[PD_from_just_u]
app_symb = {symb_ident=from_just_u_ident,symb_kind=SK_OverloadedFunction {glob_object=from_just_u_index,glob_module=stdStrictMaybes_index}}
(new_info_ptr,expr_heap) = newPtr EI_Empty expr_heap
from_just_expr = App {app_symb=app_symb,app_args=[],app_info_ptr=new_info_ptr}
unboxed_maybe = UnboxedMaybe stdStrictMaybes_index from_just_u_index nothing_u_index
unboxed_maybe = UnboxedMaybe stdStrictMaybes_index from_just_u_index none_u_index
= (unboxed_maybe,from_just_expr,expr_heap)
// conversions functions
......@@ -1527,8 +1527,8 @@ where
= build_sum_cons (buildUnboxedNilSymbIdent PD_nil_u predefs.psd_predefs_a) ds_arity heaps error
| cons_index==PD_UnboxedTailStrictNilSymbol
= build_sum_cons (buildUnboxedNilSymbIdent PD_nil_uts predefs.psd_predefs_a) ds_arity heaps error
| cons_index==PD_UnboxedNothingSymbol
= build_sum_cons (buildUnboxedNilSymbIdent PD_nothing_u predefs.psd_predefs_a) ds_arity heaps error
| cons_index==PD_UnboxedNoneSymbol
= build_sum_cons (buildUnboxedNilSymbIdent PD_none_u predefs.psd_predefs_a) ds_arity heaps error
# symb_ident = {symb_ident=ds_ident, symb_kind=SK_Constructor {glob_module=type_def_mod,glob_object=ds_index}}
= build_sum_cons symb_ident ds_arity heaps error
# symb_ident = {symb_ident=ds_ident, symb_kind=SK_Constructor {glob_module=type_def_mod,glob_object=ds_index}}
......@@ -4951,8 +4951,8 @@ build_unboxed_alg_pattern cons_ds vars args type_module_n predefs heaps
# expr = App {app_symb = cons_symb_ident, app_args = args, app_info_ptr = expr_info_ptr}
#! alg_pattern = { ap_symbol = cons_symbol, ap_vars = vars, ap_expr = expr, ap_position = NoPos }
= (alg_pattern,heaps)
| cons_index==PD_UnboxedNothingSymbol
# cons_symb_ident = buildUnboxedNilSymbIdent PD_nothing_u predefs.psd_predefs_a
| cons_index==PD_UnboxedNoneSymbol
# cons_symb_ident = buildUnboxedNilSymbIdent PD_none_u predefs.psd_predefs_a
# expr = App {app_symb = cons_symb_ident, app_args = args, app_info_ptr = expr_info_ptr}
#! alg_pattern = { ap_symbol = cons_symbol, ap_vars = vars, ap_expr = expr, ap_position = NoPos }
= (alg_pattern,heaps)
......
......@@ -285,10 +285,10 @@ where
# patterns2=replace_overloaded_symbols_in_patterns patterns2 PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol
-> merge_overloaded_list_patterns type1 decons_expr1 patterns1 patterns2 var_heap symbol_heap error
(OverloadedMaybe _ _ _,UnboxedMaybe _ _ _)
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_UnboxedJustSymbol PD_UnboxedNothingSymbol
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_UnboxedJustSymbol PD_UnboxedNoneSymbol
-> merge_overloaded_list_patterns type2 decons_expr2 patterns1 patterns2 var_heap symbol_heap error
(UnboxedMaybe _ _ _,OverloadedMaybe _ _ _)
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_UnboxedJustSymbol PD_UnboxedNothingSymbol
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_UnboxedJustSymbol PD_UnboxedNoneSymbol
-> merge_overloaded_list_patterns type1 decons_expr1 patterns1 patterns2 var_heap symbol_heap error
_
-> (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
......@@ -318,10 +318,10 @@ where
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
| type2=:OverloadedMaybe _ _ _
| gi_index==PD_MaybeTypeIndex
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_JustSymbol PD_NothingSymbol
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_JustSymbol PD_NoneSymbol
= merge_algebraic_patterns type1 patterns1 patterns2 var_heap symbol_heap error
| gi_index==PD_StrictMaybeTypeIndex
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_StrictJustSymbol PD_StrictNothingSymbol
# patterns2=replace_overloaded_maybe_symbols_in_patterns patterns2 PD_StrictJustSymbol PD_StrictNoneSymbol
= merge_algebraic_patterns type1 patterns1 patterns2 var_heap symbol_heap error
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
......@@ -343,10 +343,10 @@ where
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
| type1=:OverloadedMaybe _ _ _
| gi_index==PD_MaybeTypeIndex
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_JustSymbol PD_NothingSymbol
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_JustSymbol PD_NoneSymbol
= merge_algebraic_patterns type2 patterns1 patterns2 var_heap symbol_heap error
| gi_index==PD_StrictMaybeTypeIndex
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_StrictJustSymbol PD_StrictNothingSymbol
# patterns1=replace_overloaded_maybe_symbols_in_patterns patterns1 PD_StrictJustSymbol PD_StrictNoneSymbol
= merge_algebraic_patterns type2 patterns1 patterns2 var_heap symbol_heap error
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
= (guards, var_heap, symbol_heap, incompatible_patterns_in_case_error error)
......@@ -445,7 +445,7 @@ where
# glob_object & ds_index=pd_cons_symbol-FirstConstructorPredefinedSymbolIndex,
ds_ident=predefined_idents.[pd_cons_symbol]
= {pattern & ap_symbol.glob_object=glob_object}
| index==PD_OverloadedNothingSymbol
| index==PD_OverloadedNoneSymbol
# glob_object & ds_index=pd_nil_symbol-FirstConstructorPredefinedSymbolIndex,
ds_ident=predefined_idents.[pd_nil_symbol]
= {pattern & ap_symbol.glob_object=glob_object}
......
......@@ -104,13 +104,13 @@ PD_Arity32TupleSymbol :== 93
// same order as in MaybeIdentToken
PD_JustSymbol :== 94
PD_NothingSymbol :== 95
PD_NoneSymbol :== 95
PD_StrictJustSymbol :== 96
PD_StrictNothingSymbol :== 97
PD_StrictNoneSymbol :== 97
PD_UnboxedJustSymbol :== 98
PD_UnboxedNothingSymbol :== 99
PD_UnboxedNoneSymbol :== 99
PD_OverloadedJustSymbol :== 100
PD_OverloadedNothingSymbol :== 101
PD_OverloadedNoneSymbol :== 101
PD_UnitConsSymbol :== 102
......@@ -186,9 +186,9 @@ PD_StdStrictMaybes:==175
// same order as in MaybeIdentToken
PD_just_u:==176
PD_nothing_u:==177
PD_none_u:==177
PD_just:==178
PD_nothing:==179
PD_none:==179
PD_from_just_u:==180
PD_from_just:==181
......
......@@ -37,10 +37,10 @@ predefined_idents
[PD_StrictJustSymbol] = i "_!Just",
[PD_UnboxedJustSymbol] = i "_#Just",
[PD_OverloadedJustSymbol] = i "_|Just",
[PD_NothingSymbol] = i "_Nothing",
[PD_StrictNothingSymbol] = i "_!Nothing",
[PD_UnboxedNothingSymbol] = i "_#Nothing",
[PD_OverloadedNothingSymbol] = i "_|Nothing",
[PD_NoneSymbol] = i "_Nothing",
[PD_StrictNoneSymbol] = i "_!Nothing",
[PD_UnboxedNoneSymbol] = i "_#Nothing",
[PD_OverloadedNoneSymbol] = i "_|Nothing",
[PD_UnitConsSymbol] = i "_Unit",
[PD_PredefinedModule] = i "_predefined",
......@@ -107,8 +107,8 @@ predefined_idents
[PD_just_u] = i "_cJust_u",
[PD_from_just_u] = i "_eJust_u",
[PD_nothing] = i "_nothing",
[PD_nothing_u] = i "_nothing_u",
[PD_none] = i "_nothing",
[PD_none_u] = i "_nothing_u",
[PD_MaybeClass] = i "Maybe",
[PD_UMaybeClass] = i "UMaybe",
......@@ -343,10 +343,10 @@ where
<<= (local_predefined_idents, PD_StrictArrayType)
<<= (local_predefined_idents, PD_UnboxedArrayType)
<<= (local_predefined_idents, PD_PackedArrayType)
<<= (local_predefined_idents, PD_MaybeType) <<= (local_predefined_idents, PD_JustSymbol) <<= (local_predefined_idents, PD_NothingSymbol)
<<= (local_predefined_idents, PD_StrictMaybeType) <<= (local_predefined_idents, PD_StrictJustSymbol) <<= (local_predefined_idents, PD_StrictNothingSymbol)
<<= (local_predefined_idents, PD_UnboxedMaybeType) <<= (local_predefined_idents, PD_UnboxedJustSymbol) <<= (local_predefined_idents, PD_UnboxedNothingSymbol)
<<= (local_predefined_idents, PD_OverloadedMaybeType) <<= (local_predefined_idents, PD_OverloadedJustSymbol) <<= (local_predefined_idents, PD_OverloadedNothingSymbol)
<<= (local_predefined_idents, PD_MaybeType) <<= (local_predefined_idents, PD_JustSymbol) <<= (local_predefined_idents, PD_NoneSymbol)
<<= (local_predefined_idents, PD_StrictMaybeType) <<= (local_predefined_idents, PD_StrictJustSymbol) <<= (local_predefined_idents, PD_StrictNoneSymbol)
<<= (local_predefined_idents, PD_UnboxedMaybeType) <<= (local_predefined_idents, PD_UnboxedJustSymbol) <<= (local_predefined_idents, PD_UnboxedNoneSymbol)
<<= (local_predefined_idents, PD_OverloadedMaybeType) <<= (local_predefined_idents, PD_OverloadedJustSymbol) <<= (local_predefined_idents, PD_OverloadedNoneSymbol)
<<= (local_predefined_idents, PD_UnitType) <<= (local_predefined_idents, PD_UnitConsSymbol)
<<= (local_predefined_idents, PD_TypeCodeMember)
<<= (local_predefined_idents, PD_DummyForStrictAliasFun) // MW++
......@@ -461,19 +461,19 @@ make_list_definition list_type_pre_def_symbol_index cons_pre_def_symbol_index ni
= (list_def,ParsedConstructorToConsDef cons_def,ParsedConstructorToConsDef nil_def,pre_def_symbols)
make_maybe_definition :: Int Int Int Ident TypeVar AType StrictnessList *{#PredefinedSymbol} -> (!TypeDef TypeRhs,!ConsDef,!ConsDef,!.{#PredefinedSymbol})
make_maybe_definition maybe_type_pre_def_symbol_index just_pre_def_symbol_index nothing_pre_def_symbol_index pre_mod_id type_var type_var_with_attr just_strictness pre_def_symbols
make_maybe_definition maybe_type_pre_def_symbol_index just_pre_def_symbol_index none_pre_def_symbol_index pre_mod_id type_var type_var_with_attr just_strictness pre_def_symbols
# just_ident = predefined_idents.[just_pre_def_symbol_index]
nothing_ident = predefined_idents.[nothing_pre_def_symbol_index]
none_ident = predefined_idents.[none_pre_def_symbol_index]
maybe_ident = predefined_idents.[maybe_type_pre_def_symbol_index]
just_ds = { ds_ident = just_ident, ds_arity = 1, ds_index = just_pre_def_symbol_index-FirstConstructorPredefinedSymbolIndex }
nothing_ds = { ds_ident = nothing_ident, ds_arity = 0, ds_index = nothing_pre_def_symbol_index-FirstConstructorPredefinedSymbolIndex }
(maybe_def, pre_def_symbols) = make_type_def maybe_type_pre_def_symbol_index [type_var] (AlgType [just_ds,nothing_ds]) pre_def_symbols
none_ds = { ds_ident = none_ident, ds_arity = 0, ds_index = none_pre_def_symbol_index-FirstConstructorPredefinedSymbolIndex }
(maybe_def, pre_def_symbols) = make_type_def maybe_type_pre_def_symbol_index [type_var] (AlgType [just_ds,none_ds]) pre_def_symbols
just_def = { pc_cons_ident = just_ident, pc_cons_arity = 1, pc_arg_types = [type_var_with_attr], pc_context = [],
pc_args_strictness=just_strictness, pc_cons_prio = NoPrio, pc_exi_vars = [], pc_cons_pos = PreDefPos pre_mod_id}
nothing_def = { pc_cons_ident = nothing_ident, pc_cons_arity = 0, pc_arg_types = [], pc_args_strictness=NotStrict, pc_context = [],
pc_cons_prio = NoPrio, pc_exi_vars = [], pc_cons_pos = PreDefPos pre_mod_id}
= (maybe_def,ParsedConstructorToConsDef just_def,ParsedConstructorToConsDef nothing_def,pre_def_symbols)
none_def = { pc_cons_ident = none_ident, pc_cons_arity = 0, pc_arg_types = [], pc_args_strictness=NotStrict, pc_context = [],
pc_cons_prio = NoPrio, pc_exi_vars = [], pc_cons_pos = PreDefPos pre_mod_id}
= (maybe_def,ParsedConstructorToConsDef just_def,ParsedConstructorToConsDef none_def,pre_def_symbols)
make_unit_definition :: Ident *{#PredefinedSymbol} -> (!TypeDef TypeRhs,!ConsDef,!.{#PredefinedSymbol})
make_unit_definition pre_mod_id pre_def_symbols
......@@ -518,21 +518,21 @@ buildPredefinedModule support_dynamics pre_def_symbols
(unboxed_def, pre_def_symbols) = make_type_def PD_UnboxedArrayType [type_var] (AbstractType cAllBitsClear) pre_def_symbols
(packed_def, pre_def_symbols) = make_type_def PD_PackedArrayType [type_var] (AbstractType cAllBitsClear) pre_def_symbols
(maybe_def,just_def,nothing_def,pre_def_symbols)
= make_maybe_definition PD_MaybeType PD_JustSymbol PD_NothingSymbol pre_mod_ident type_var type_var_with_attr NotStrict pre_def_symbols
(strict_maybe_def,strict_just_def,strict_nothing_def,pre_def_symbols)
= make_maybe_definition PD_StrictMaybeType PD_StrictJustSymbol PD_StrictNothingSymbol pre_mod_ident type_var type_var_with_attr (Strict 1) pre_def_symbols
(unboxed_maybe_def,unboxed_just_def,unboxed_nothing_def,pre_def_symbols)
= make_maybe_definition PD_UnboxedMaybeType PD_UnboxedJustSymbol PD_UnboxedNothingSymbol pre_mod_ident type_var type_var_with_attr (Strict 1) pre_def_symbols
(overloaded_maybe_def,overloaded_just_def,overloaded_nothing_def,pre_def_symbols)
= make_maybe_definition PD_OverloadedMaybeType PD_OverloadedJustSymbol PD_OverloadedNothingSymbol pre_mod_ident type_var type_var_with_attr NotStrict pre_def_symbols
(maybe_def,just_def,none_def,pre_def_symbols)
= make_maybe_definition PD_MaybeType PD_JustSymbol PD_NoneSymbol pre_mod_ident type_var type_var_with_attr NotStrict pre_def_symbols
(strict_maybe_def,strict_just_def,strict_none_def,pre_def_symbols)
= make_maybe_definition PD_StrictMaybeType PD_StrictJustSymbol PD_StrictNoneSymbol pre_mod_ident type_var type_var_with_attr (Strict 1) pre_def_symbols
(unboxed_maybe_def,unboxed_just_def,unboxed_none_def,pre_def_symbols)
= make_maybe_definition PD_UnboxedMaybeType PD_UnboxedJustSymbol PD_UnboxedNoneSymbol pre_mod_ident type_var type_var_with_attr (Strict 1) pre_def_symbols
(overloaded_maybe_def,overloaded_just_def,overloaded_none_def,pre_def_symbols)
= make_maybe_definition PD_OverloadedMaybeType PD_OverloadedJustSymbol PD_OverloadedNoneSymbol pre_mod_ident type_var type_var_with_attr NotStrict pre_def_symbols
(unit_type_def,unit_cons_def,pre_def_symbols) = make_unit_definition pre_mod_ident pre_def_symbols
array_and_unit_type_defs
= [array_def,strict_def,unboxed_def,packed_def,maybe_def,strict_maybe_def,unboxed_maybe_def,overloaded_maybe_def,unit_type_def]
cons_defs = [just_def,nothing_def,strict_just_def,strict_nothing_def,
unboxed_just_def,unboxed_nothing_def,overloaded_just_def,overloaded_nothing_def,unit_cons_def]
cons_defs = [just_def,none_def,strict_just_def,strict_none_def,
unboxed_just_def,unboxed_none_def,overloaded_just_def,overloaded_none_def,unit_cons_def]
(type_defs, cons_defs, pre_def_symbols)
= add_tuple_defs pre_mod_ident MaxTupleArity array_and_unit_type_defs cons_defs pre_def_symbols
......
......@@ -672,8 +672,8 @@ where
# cons_index=cons_ds_index+FirstConstructorPredefinedSymbolIndex
| index==PD_OverloadedJustSymbol
= cons_index==PD_JustSymbol || cons_index==PD_StrictJustSymbol
| index==PD_OverloadedNothingSymbol
= cons_index==PD_NothingSymbol || cons_index==PD_StrictNothingSymbol
| index==PD_OverloadedNoneSymbol
= cons_index==PD_NoneSymbol || cons_index==PD_StrictNoneSymbol
= abort "equal_maybe_contructor"
match_and_instantiate_overloaded_maybe _ cons_index app_args [] cons_types case_default ro ti
= transform case_default { ro & ro_root_case_mode = NotRootCase } ti
......
......@@ -1007,7 +1007,7 @@ fresh_overloaded_list_type [{ap_symbol}:patterns] pd_cons_symbol pd_nil_symbol d
TAS _ args=:[arg1,arg2] _ -> args
= (argument_types,result_type,tst_context,tst_attr_env,ts)
fresh_overloaded_maybe_type [{ap_symbol}:patterns] pd_just_symbol pd_nothing_symbol from_just_index nothing_index stdStrictMaybes_index pos functions common_defs ts
fresh_overloaded_maybe_type [{ap_symbol}:patterns] pd_just_symbol pd_none_symbol from_just_index none_index stdStrictMaybes_index pos functions common_defs ts
| ap_symbol.glob_module==cPredefinedModuleIndex
| ap_symbol.glob_object.ds_index==pd_just_symbol-FirstConstructorPredefinedSymbolIndex
# (argument_types,result_type,tst_context,tst_attr_env,ts) = make_just_type_from_from_just_type stdStrictMaybes_index from_just_index common_defs ts
......@@ -1015,12 +1015,12 @@ fresh_overloaded_maybe_type [{ap_symbol}:patterns] pd_just_symbol pd_nothing_sym
[]
-> ([argument_types],result_type,tst_context,tst_attr_env,ts)
[pattern=:{ap_symbol}]
| ap_symbol.glob_module==cPredefinedModuleIndex && ap_symbol.glob_object.ds_index==pd_nothing_symbol-FirstConstructorPredefinedSymbolIndex
| ap_symbol.glob_module==cPredefinedModuleIndex && ap_symbol.glob_object.ds_index==pd_none_symbol-FirstConstructorPredefinedSymbolIndex
-> ([argument_types,[]],result_type,tst_context,tst_attr_env,ts)
| ap_symbol.glob_object.ds_index==pd_nothing_symbol-FirstConstructorPredefinedSymbolIndex
| ap_symbol.glob_object.ds_index==pd_none_symbol-FirstConstructorPredefinedSymbolIndex
= case patterns of
[]
# {ft_type,ft_ident,ft_type_ptr,ft_specials} = functions.[stdStrictMaybes_index].[nothing_index]
# {ft_type,ft_ident,ft_type_ptr,ft_specials} = functions.[stdStrictMaybes_index].[none_index]
# (fun_type_copy, ts) = determineSymbolTypeOfFunction pos ft_ident 0 ft_type ft_type_ptr common_defs ts
{tst_args,tst_result,tst_context,tst_attr_env}=fun_type_copy
-> ([tst_args],tst_result,tst_context,tst_attr_env,ts)
......@@ -1045,10 +1045,10 @@ freshOverloadedPatternType (UnboxedTailStrictList stdStrictLists_index decons_u_
= fresh_overloaded_list_type patterns PD_UnboxedTailStrictConsSymbol PD_UnboxedTailStrictNilSymbol decons_u_index nil_u_index stdStrictLists_index pos functions common_defs ts
freshOverloadedPatternType (OverloadedList stdStrictLists_index decons_u_index nil_u_index) pos patterns common_defs functions ts
= fresh_overloaded_list_type patterns PD_OverloadedConsSymbol PD_OverloadedNilSymbol decons_u_index nil_u_index stdStrictLists_index pos functions common_defs ts
freshOverloadedPatternType (UnboxedMaybe stdStrictMaybes_index from_just_u_index nothing_u_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_UnboxedJustSymbol PD_UnboxedNothingSymbol from_just_u_index nothing_u_index stdStrictMaybes_index pos functions common_defs ts
freshOverloadedPatternType (OverloadedMaybe stdStrictMaybes_index from_just_index nothing_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_OverloadedJustSymbol PD_OverloadedNothingSymbol from_just_index nothing_index stdStrictMaybes_index pos functions common_defs ts
freshOverloadedPatternType (UnboxedMaybe stdStrictMaybes_index from_just_u_index none_u_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_UnboxedJustSymbol PD_UnboxedNoneSymbol from_just_u_index none_u_index stdStrictMaybes_index pos functions common_defs ts
freshOverloadedPatternType (OverloadedMaybe stdStrictMaybes_index from_just_index none_index) pos patterns common_defs functions ts
= fresh_overloaded_maybe_type patterns PD_OverloadedJustSymbol PD_OverloadedNoneSymbol from_just_index none_index stdStrictMaybes_index pos functions common_defs ts
cWithFreshContextVars :== True
cWithoutFreshContextVars :== False
......
......@@ -58,7 +58,7 @@ TypeSymbIdentWithoutDefinition :== (toChar 29) // valid only for predefined in
TypeSymbIdentWithDefinition :== (toChar 30) // for all types which have definitions in some .icl-module
// Maybe
MaybeNothingCode :== (toChar 31)
MaybeNoneCode :== (toChar 31)
MaybeJustCode :== (toChar 32)
// StrictnessList
......
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