diff --git a/cours/cours-parsing.pdf b/cours/cours-parsing.pdf index bd537b1..65ca4a7 100644 Binary files a/cours/cours-parsing.pdf and b/cours/cours-parsing.pdf differ diff --git a/flap/src/hopix/hopixTypes.ml b/flap/src/hopix/hopixTypes.ml index dcf0e64..5301b16 100644 --- a/flap/src/hopix/hopixTypes.ml +++ b/flap/src/hopix/hopixTypes.ml @@ -3,8 +3,6 @@ open HopixASTHelper let type_error = Error.error "typechecking" -type variable = type_variable - type aty = | ATyVar of type_variable | ATyCon of type_constructor * aty list @@ -82,12 +80,6 @@ let tvar x = let ( --> ) tys ty = List.fold_left (fun ty aty -> ATyArrow (aty, ty)) ty (List.rev tys) -exception NotAFunction - -let output_type_of_function = function - | ATyArrow (_, ty) -> ty - | _ -> raise NotAFunction - let constant x = TCon x, ATyCon (TCon x, []) let tcunit, hunit = constant "unit" let tcbool, hbool = constant "bool" @@ -98,8 +90,6 @@ let tcchar, hchar = constant "char" let tcref = TCon "mut" let href ty = ATyCon (tcref, [ty]) -exception NotAReference - let type_error_wrong_shape shape pos given = type_error pos (Printf.sprintf @@ -249,7 +239,7 @@ let free_type_variables_env_values { values; _ } = TypeVariableSet.empty values -let generalize_type_scheme env aty = +let generalize_type env aty = let open TypeVariableSet in let free_aty = free_type_variables aty in let free_env = free_type_variables_env_values env in diff --git a/flap/src/hopix/hopixTypes.mli b/flap/src/hopix/hopixTypes.mli index 981d471..fe7f402 100644 --- a/flap/src/hopix/hopixTypes.mli +++ b/flap/src/hopix/hopixTypes.mli @@ -1,23 +1,51 @@ +(** {1 Internal Types} *) + +(** This module defines an (OCaml) type of (Hopix) types as manipulated by the + typechecker. Such {i internal} types differ from the source-level {i + external} types defined in {! HopixAST} in that they are not annotated with + source-level positions. + + In a more realistic compiler, the distance between internal and external + types would be greater. *) + open HopixAST -(** Abstract syntax for types. - - The following internal syntax for types is the same as the one for the types - [ty] defined in {!HopixAST} except that all positions have been erased. *) +(** Internal types. *) type aty = | ATyVar of type_variable | ATyCon of type_constructor * aty list | ATyTuple of aty list | ATyArrow of aty * aty +(** Internal type schemes. *) type aty_scheme = Scheme of type_variable list * aty +(** {2 Error management} *) + +val type_error : Position.t -> string -> 'a + +(** {2 Utility functions} *) + val string_of_aty : aty -> string val monomorphic_type_scheme : aty -> aty_scheme val instantiate_type_scheme : aty_scheme -> aty list -> aty +(** {3 Type construction and destruction} *) + +val hunit : aty +val hint : aty +val hbool : aty +val hstring : aty +val hchar : aty +val hprod : aty list -> aty +val href : aty -> aty + +(** The type of destructuring functions, which receive a type and destruct it + into its constituents. Such functions fail by raising an exception if the + type is not of the expected shape, e.g., [destruct_function_type (ATyVar x)] + always raise an exception. *) type 'res destruction_fun = Position.t -> aty -> 'res val destruct_function_type : (aty * aty) destruction_fun @@ -30,6 +58,8 @@ val destruct_constructed_type : (type_constructor * aty list) destruction_fun val destruct_reference_type : aty destruction_fun +(** {2 Typing Contexts} *) + type typing_environment val initial_typing_environment : unit -> typing_environment @@ -42,6 +72,8 @@ val bind_type_variable : val bind_type_variables : Position.t -> typing_environment -> type_variable list -> typing_environment +(** [internalize_ty env ety] internalizes the external type [ety]. It signals an + error when [ety] is not well-formed in [env]. *) val internalize_ty : typing_environment -> ty Position.located -> aty type binding = @@ -79,16 +111,6 @@ val bind_type_definition : type_constructor -> type_variable list -> type_definition -> typing_environment -> typing_environment -val type_error : Position.t -> string -> 'a - -val hunit : aty -val hint : aty -val hbool : aty -val hstring : aty -val hchar : aty -val hprod : aty list -> aty -val href : aty -> aty - -val generalize_type_scheme : typing_environment -> aty -> aty_scheme - val string_of_typing_environment : typing_environment -> string + +val generalize_type : typing_environment -> aty -> aty_scheme diff --git a/flap/tests/03-Typing/01-int-literal.bad.expected b/flap/tests/03-Typing/01-int-literal.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/01-int-literal.bad.typing.hopix b/flap/tests/03-Typing/01-int-literal.bad.typing.hopix new file mode 100644 index 0000000..248a2c2 --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Literal((value(LInt 42))(position((start_p(""1 0 14))(end_p(""1 0 16)))))))(position((start_p(""1 0 14))(end_p(""1 0 16)))))))))(position((start_p(""1 0 0))(end_p(""1 0 16)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""2 17 21))(end_p(""2 17 22)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""2 17 25))(end_p(""2 17 31)))))))(position((start_p(""2 17 25))(end_p(""2 17 31))))))((value(Literal((value(LInt -42))(position((start_p(""2 17 34))(end_p(""2 17 37)))))))(position((start_p(""2 17 34))(end_p(""2 17 37)))))))))(position((start_p(""2 17 17))(end_p(""2 17 37)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/01-int-literal.bad.typing.hopix.human-readable b/flap/tests/03-Typing/01-int-literal.bad.typing.hopix.human-readable new file mode 100644 index 0000000..a903fb8 --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.bad.typing.hopix.human-readable @@ -0,0 +1,2 @@ +let x : int = 42 +let y : string = -42 \ No newline at end of file diff --git a/flap/tests/03-Typing/01-int-literal.good.expected b/flap/tests/03-Typing/01-int-literal.good.expected new file mode 100644 index 0000000..ac42051 --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.good.expected @@ -0,0 +1,2 @@ +x : int +y : int diff --git a/flap/tests/03-Typing/01-int-literal.good.typing.hopix b/flap/tests/03-Typing/01-int-literal.good.typing.hopix new file mode 100644 index 0000000..a9c4bbf --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Literal((value(LInt 42))(position((start_p(""1 0 14))(end_p(""1 0 16)))))))(position((start_p(""1 0 14))(end_p(""1 0 16)))))))))(position((start_p(""1 0 0))(end_p(""1 0 16)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""2 17 21))(end_p(""2 17 22)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""2 17 25))(end_p(""2 17 28)))))))(position((start_p(""2 17 25))(end_p(""2 17 28))))))((value(Literal((value(LInt -42))(position((start_p(""2 17 31))(end_p(""2 17 34)))))))(position((start_p(""2 17 31))(end_p(""2 17 34)))))))))(position((start_p(""2 17 17))(end_p(""2 17 34)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/01-int-literal.good.typing.hopix.human-readable b/flap/tests/03-Typing/01-int-literal.good.typing.hopix.human-readable new file mode 100644 index 0000000..c0c128b --- /dev/null +++ b/flap/tests/03-Typing/01-int-literal.good.typing.hopix.human-readable @@ -0,0 +1,2 @@ +let x : int = 42 +let y : int = -42 \ No newline at end of file diff --git a/flap/tests/03-Typing/02-arith-01.bad.expected b/flap/tests/03-Typing/02-arith-01.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/02-arith-01.bad.typing.hopix b/flap/tests/03-Typing/02-arith-01.bad.typing.hopix new file mode 100644 index 0000000..9f82593 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LString foo))(position((start_p(""1 0 22))(end_p(""1 0 23)))))))(position((start_p(""1 0 22))(end_p(""1 0 23)))))))(position((start_p(""1 0 14))(end_p(""1 0 23)))))))))(position((start_p(""1 0 0))(end_p(""1 0 23)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/02-arith-01.bad.typing.hopix.human-readable b/flap/tests/03-Typing/02-arith-01.bad.typing.hopix.human-readable new file mode 100644 index 0000000..3824630 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 + "foo" \ No newline at end of file diff --git a/flap/tests/03-Typing/02-arith-01.good.expected b/flap/tests/03-Typing/02-arith-01.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/02-arith-01.good.typing.hopix b/flap/tests/03-Typing/02-arith-01.good.typing.hopix new file mode 100644 index 0000000..8706075 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))))))(position((start_p(""1 0 0))(end_p(""1 0 19)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/02-arith-01.good.typing.hopix.human-readable b/flap/tests/03-Typing/02-arith-01.good.typing.hopix.human-readable new file mode 100644 index 0000000..5070776 --- /dev/null +++ b/flap/tests/03-Typing/02-arith-01.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 + 1 \ No newline at end of file diff --git a/flap/tests/03-Typing/03-arith-02.bad.expected b/flap/tests/03-Typing/03-arith-02.bad.expected new file mode 100644 index 0000000..fa86d59 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + char diff --git a/flap/tests/03-Typing/03-arith-02.bad.typing.hopix b/flap/tests/03-Typing/03-arith-02.bad.typing.hopix new file mode 100644 index 0000000..ca0ce09 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LChar a))(position((start_p(""1 0 18))(end_p(""1 0 21)))))))(position((start_p(""1 0 18))(end_p(""1 0 21)))))))(position((start_p(""1 0 14))(end_p(""1 0 21)))))))))(position((start_p(""1 0 0))(end_p(""1 0 21)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/03-arith-02.bad.typing.hopix.human-readable b/flap/tests/03-Typing/03-arith-02.bad.typing.hopix.human-readable new file mode 100644 index 0000000..ec20d47 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 * 'a' \ No newline at end of file diff --git a/flap/tests/03-Typing/03-arith-02.good.expected b/flap/tests/03-Typing/03-arith-02.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/03-arith-02.good.typing.hopix b/flap/tests/03-Typing/03-arith-02.good.typing.hopix new file mode 100644 index 0000000..b89b997 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))))))(position((start_p(""1 0 0))(end_p(""1 0 19)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/03-arith-02.good.typing.hopix.human-readable b/flap/tests/03-Typing/03-arith-02.good.typing.hopix.human-readable new file mode 100644 index 0000000..c1d6359 --- /dev/null +++ b/flap/tests/03-Typing/03-arith-02.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 * 2 \ No newline at end of file diff --git a/flap/tests/03-Typing/04-arith-03.bad.expected b/flap/tests/03-Typing/04-arith-03.bad.expected new file mode 100644 index 0000000..fa86d59 --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + char diff --git a/flap/tests/03-Typing/04-arith-03.bad.typing.hopix b/flap/tests/03-Typing/04-arith-03.bad.typing.hopix new file mode 100644 index 0000000..119761b --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""1 0 18))(end_p(""1 0 19)))))()))(position((start_p(""1 0 18))(end_p(""1 0 19)))))((value(Literal((value(LChar a))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 14))(end_p(""1 0 17)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 20))(end_p(""1 0 21)))))))(position((start_p(""1 0 20))(end_p(""1 0 21)))))))(position((start_p(""1 0 14))(end_p(""1 0 21)))))))))(position((start_p(""1 0 0))(end_p(""1 0 21)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/04-arith-03.bad.typing.hopix.human-readable b/flap/tests/03-Typing/04-arith-03.bad.typing.hopix.human-readable new file mode 100644 index 0000000..a53568c --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 'a' - 2 \ No newline at end of file diff --git a/flap/tests/03-Typing/04-arith-03.good.expected b/flap/tests/03-Typing/04-arith-03.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/04-arith-03.good.typing.hopix b/flap/tests/03-Typing/04-arith-03.good.typing.hopix new file mode 100644 index 0000000..a39b41f --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))))))(position((start_p(""1 0 0))(end_p(""1 0 19)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/04-arith-03.good.typing.hopix.human-readable b/flap/tests/03-Typing/04-arith-03.good.typing.hopix.human-readable new file mode 100644 index 0000000..b64a54d --- /dev/null +++ b/flap/tests/03-Typing/04-arith-03.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 - 2 \ No newline at end of file diff --git a/flap/tests/03-Typing/06-arith-04.bad.expected b/flap/tests/03-Typing/06-arith-04.bad.expected new file mode 100644 index 0000000..fa86d59 --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + char diff --git a/flap/tests/03-Typing/06-arith-04.bad.typing.hopix b/flap/tests/03-Typing/06-arith-04.bad.typing.hopix new file mode 100644 index 0000000..192968e --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `/`))(position((start_p(""1 0 18))(end_p(""1 0 19)))))()))(position((start_p(""1 0 18))(end_p(""1 0 19)))))((value(Literal((value(LChar a))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 14))(end_p(""1 0 17)))))((value(Literal((value(LChar a))(position((start_p(""1 0 20))(end_p(""1 0 23)))))))(position((start_p(""1 0 20))(end_p(""1 0 23)))))))(position((start_p(""1 0 14))(end_p(""1 0 23)))))))))(position((start_p(""1 0 0))(end_p(""1 0 23)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/06-arith-04.bad.typing.hopix.human-readable b/flap/tests/03-Typing/06-arith-04.bad.typing.hopix.human-readable new file mode 100644 index 0000000..2f7a076 --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 'a' / 'a' \ No newline at end of file diff --git a/flap/tests/03-Typing/06-arith-04.good.expected b/flap/tests/03-Typing/06-arith-04.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/06-arith-04.good.typing.hopix b/flap/tests/03-Typing/06-arith-04.good.typing.hopix new file mode 100644 index 0000000..ee16791 --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `/`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))))))(position((start_p(""1 0 0))(end_p(""1 0 19)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/06-arith-04.good.typing.hopix.human-readable b/flap/tests/03-Typing/06-arith-04.good.typing.hopix.human-readable new file mode 100644 index 0000000..d0196b8 --- /dev/null +++ b/flap/tests/03-Typing/06-arith-04.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 / 2 \ No newline at end of file diff --git a/flap/tests/03-Typing/07-arith-05.bad.expected b/flap/tests/03-Typing/07-arith-05.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/07-arith-05.bad.typing.hopix b/flap/tests/03-Typing/07-arith-05.bad.typing.hopix new file mode 100644 index 0000000..a327993 --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""1 0 8))(end_p(""1 0 14)))))))(position((start_p(""1 0 8))(end_p(""1 0 14))))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""1 0 31))(end_p(""1 0 32)))))()))(position((start_p(""1 0 31))(end_p(""1 0 32)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""1 0 23))(end_p(""1 0 24)))))()))(position((start_p(""1 0 23))(end_p(""1 0 24)))))((value(Apply((value(Apply((value(Variable((value(Id `/`))(position((start_p(""1 0 19))(end_p(""1 0 20)))))()))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 17))(end_p(""1 0 18)))))))(position((start_p(""1 0 17))(end_p(""1 0 18)))))))(position((start_p(""1 0 17))(end_p(""1 0 18)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 21))(end_p(""1 0 22)))))))(position((start_p(""1 0 21))(end_p(""1 0 22)))))))(position((start_p(""1 0 17))(end_p(""1 0 22)))))))(position((start_p(""1 0 17))(end_p(""1 0 22)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""1 0 27))(end_p(""1 0 28)))))()))(position((start_p(""1 0 27))(end_p(""1 0 28)))))((value(Literal((value(LInt 3))(position((start_p(""1 0 25))(end_p(""1 0 26)))))))(position((start_p(""1 0 25))(end_p(""1 0 26)))))))(position((start_p(""1 0 25))(end_p(""1 0 26)))))((value(Literal((value(LInt 5))(position((start_p(""1 0 29))(end_p(""1 0 30)))))))(position((start_p(""1 0 29))(end_p(""1 0 30)))))))(position((start_p(""1 0 25))(end_p(""1 0 30)))))))(position((start_p(""1 0 17))(end_p(""1 0 30)))))))(position((start_p(""1 0 17))(end_p(""1 0 30)))))((value(Literal((value(LInt 6))(position((start_p(""1 0 33))(end_p(""1 0 34)))))))(position((start_p(""1 0 33))(end_p(""1 0 34)))))))(position((start_p(""1 0 17))(end_p(""1 0 34)))))))))(position((start_p(""1 0 0))(end_p(""1 0 34)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/07-arith-05.bad.typing.hopix.human-readable b/flap/tests/03-Typing/07-arith-05.bad.typing.hopix.human-readable new file mode 100644 index 0000000..4b32389 --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : string = 1 / 2 + 3 * 5 - 6 \ No newline at end of file diff --git a/flap/tests/03-Typing/07-arith-05.good.expected b/flap/tests/03-Typing/07-arith-05.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/07-arith-05.good.typing.hopix b/flap/tests/03-Typing/07-arith-05.good.typing.hopix new file mode 100644 index 0000000..0a2b24b --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""1 0 28))(end_p(""1 0 29)))))()))(position((start_p(""1 0 28))(end_p(""1 0 29)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""1 0 20))(end_p(""1 0 21)))))()))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(Apply((value(Apply((value(Variable((value(Id `/`))(position((start_p(""1 0 16))(end_p(""1 0 17)))))()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))))(position((start_p(""1 0 14))(end_p(""1 0 15)))))((value(Literal((value(LInt 2))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 18))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))))(position((start_p(""1 0 14))(end_p(""1 0 19)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""1 0 24))(end_p(""1 0 25)))))()))(position((start_p(""1 0 24))(end_p(""1 0 25)))))((value(Literal((value(LInt 3))(position((start_p(""1 0 22))(end_p(""1 0 23)))))))(position((start_p(""1 0 22))(end_p(""1 0 23)))))))(position((start_p(""1 0 22))(end_p(""1 0 23)))))((value(Literal((value(LInt 5))(position((start_p(""1 0 26))(end_p(""1 0 27)))))))(position((start_p(""1 0 26))(end_p(""1 0 27)))))))(position((start_p(""1 0 22))(end_p(""1 0 27)))))))(position((start_p(""1 0 14))(end_p(""1 0 27)))))))(position((start_p(""1 0 14))(end_p(""1 0 27)))))((value(Literal((value(LInt 6))(position((start_p(""1 0 30))(end_p(""1 0 31)))))))(position((start_p(""1 0 30))(end_p(""1 0 31)))))))(position((start_p(""1 0 14))(end_p(""1 0 31)))))))))(position((start_p(""1 0 0))(end_p(""1 0 31)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/07-arith-05.good.typing.hopix.human-readable b/flap/tests/03-Typing/07-arith-05.good.typing.hopix.human-readable new file mode 100644 index 0000000..c026fcd --- /dev/null +++ b/flap/tests/03-Typing/07-arith-05.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = 1 / 2 + 3 * 5 - 6 \ No newline at end of file diff --git a/flap/tests/03-Typing/08-char-literal.bad.expected b/flap/tests/03-Typing/08-char-literal.bad.expected new file mode 100644 index 0000000..fa86d59 --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + char diff --git a/flap/tests/03-Typing/08-char-literal.bad.typing.hopix b/flap/tests/03-Typing/08-char-literal.bad.typing.hopix new file mode 100644 index 0000000..bdff1b5 --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id c))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Literal((value(LChar a))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))))(position((start_p(""1 0 0))(end_p(""1 0 17)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/08-char-literal.bad.typing.hopix.human-readable b/flap/tests/03-Typing/08-char-literal.bad.typing.hopix.human-readable new file mode 100644 index 0000000..a4089fd --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let c : int = 'a' \ No newline at end of file diff --git a/flap/tests/03-Typing/08-char-literal.good.expected b/flap/tests/03-Typing/08-char-literal.good.expected new file mode 100644 index 0000000..c5972d9 --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.good.expected @@ -0,0 +1 @@ +c : char diff --git a/flap/tests/03-Typing/08-char-literal.good.typing.hopix b/flap/tests/03-Typing/08-char-literal.good.typing.hopix new file mode 100644 index 0000000..bd833ba --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id c))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon char)()))(position((start_p(""1 0 8))(end_p(""1 0 12)))))))(position((start_p(""1 0 8))(end_p(""1 0 12))))))((value(Literal((value(LChar a))(position((start_p(""1 0 15))(end_p(""1 0 18)))))))(position((start_p(""1 0 15))(end_p(""1 0 18)))))))))(position((start_p(""1 0 0))(end_p(""1 0 18)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/08-char-literal.good.typing.hopix.human-readable b/flap/tests/03-Typing/08-char-literal.good.typing.hopix.human-readable new file mode 100644 index 0000000..feea91c --- /dev/null +++ b/flap/tests/03-Typing/08-char-literal.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let c : char = 'a' \ No newline at end of file diff --git a/flap/tests/03-Typing/09-char-string.bad.expected b/flap/tests/03-Typing/09-char-string.bad.expected new file mode 100644 index 0000000..10a1a2e --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + char +Given: + string diff --git a/flap/tests/03-Typing/09-char-string.bad.typing.hopix b/flap/tests/03-Typing/09-char-string.bad.typing.hopix new file mode 100644 index 0000000..d8b440c --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id c))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon char)()))(position((start_p(""1 0 8))(end_p(""1 0 12)))))))(position((start_p(""1 0 8))(end_p(""1 0 12))))))((value(Literal((value(LString"Luke, I may be your father!"))(position((start_p(""1 0 43))(end_p(""1 0 44)))))))(position((start_p(""1 0 43))(end_p(""1 0 44)))))))))(position((start_p(""1 0 0))(end_p(""1 0 44)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/09-char-string.bad.typing.hopix.human-readable b/flap/tests/03-Typing/09-char-string.bad.typing.hopix.human-readable new file mode 100644 index 0000000..c03b8db --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let c : char = "Luke, I may be your father!" \ No newline at end of file diff --git a/flap/tests/03-Typing/09-char-string.good.expected b/flap/tests/03-Typing/09-char-string.good.expected new file mode 100644 index 0000000..aa5dda4 --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.good.expected @@ -0,0 +1 @@ +c : string diff --git a/flap/tests/03-Typing/09-char-string.good.typing.hopix b/flap/tests/03-Typing/09-char-string.good.typing.hopix new file mode 100644 index 0000000..6a62a20 --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id c))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""1 0 8))(end_p(""1 0 14)))))))(position((start_p(""1 0 8))(end_p(""1 0 14))))))((value(Literal((value(LString"Luke, I may be your father!"))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))))(position((start_p(""1 0 0))(end_p(""1 0 46)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/09-char-string.good.typing.hopix.human-readable b/flap/tests/03-Typing/09-char-string.good.typing.hopix.human-readable new file mode 100644 index 0000000..cbbf0da --- /dev/null +++ b/flap/tests/03-Typing/09-char-string.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let c : string = "Luke, I may be your father!" \ No newline at end of file diff --git a/flap/tests/03-Typing/10-local-definition.bad.expected b/flap/tests/03-Typing/10-local-definition.bad.expected new file mode 100644 index 0000000..c801825 --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Unbound identifier `y'. diff --git a/flap/tests/03-Typing/10-local-definition.bad.typing.hopix b/flap/tests/03-Typing/10-local-definition.bad.typing.hopix new file mode 100644 index 0000000..2cfdb25 --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""1 0 4))(end_p(""1 0 8)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 11))(end_p(""1 0 14)))))))(position((start_p(""1 0 11))(end_p(""1 0 14))))))((value(Define(SimpleValue(((value(Id x))(position((start_p(""2 17 25))(end_p(""2 17 26)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""2 17 29))(end_p(""2 17 32)))))))(position((start_p(""2 17 29))(end_p(""2 17 32))))))((value(Literal((value(LInt 1))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))((value(Variable((value(Id y))(position((start_p(""3 38 42))(end_p(""3 38 43)))))()))(position((start_p(""3 38 42))(end_p(""3 38 43)))))))(position((start_p(""2 17 21))(end_p(""3 38 43)))))))))(position((start_p(""1 0 0))(end_p(""3 38 43)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/10-local-definition.bad.typing.hopix.human-readable b/flap/tests/03-Typing/10-local-definition.bad.typing.hopix.human-readable new file mode 100644 index 0000000..db142c2 --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +let main : int = + let x : int = 1; + y \ No newline at end of file diff --git a/flap/tests/03-Typing/10-local-definition.good.expected b/flap/tests/03-Typing/10-local-definition.good.expected new file mode 100644 index 0000000..4b66f6f --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.good.expected @@ -0,0 +1 @@ +main : int diff --git a/flap/tests/03-Typing/10-local-definition.good.typing.hopix b/flap/tests/03-Typing/10-local-definition.good.typing.hopix new file mode 100644 index 0000000..5c9149f --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""1 0 4))(end_p(""1 0 8)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 11))(end_p(""1 0 14)))))))(position((start_p(""1 0 11))(end_p(""1 0 14))))))((value(Define(SimpleValue(((value(Id x))(position((start_p(""2 17 25))(end_p(""2 17 26)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""2 17 29))(end_p(""2 17 32)))))))(position((start_p(""2 17 29))(end_p(""2 17 32))))))((value(Literal((value(LInt 1))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))((value(Variable((value(Id x))(position((start_p(""3 38 42))(end_p(""3 38 43)))))()))(position((start_p(""3 38 42))(end_p(""3 38 43)))))))(position((start_p(""2 17 21))(end_p(""3 38 43)))))))))(position((start_p(""1 0 0))(end_p(""3 38 43)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/10-local-definition.good.typing.hopix.human-readable b/flap/tests/03-Typing/10-local-definition.good.typing.hopix.human-readable new file mode 100644 index 0000000..1f6b396 --- /dev/null +++ b/flap/tests/03-Typing/10-local-definition.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +let main : int = + let x : int = 1; + x \ No newline at end of file diff --git a/flap/tests/03-Typing/11-function-definition.bad.expected b/flap/tests/03-Typing/11-function-definition.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/11-function-definition.bad.typing.hopix b/flap/tests/03-Typing/11-function-definition.bad.typing.hopix new file mode 100644 index 0000000..c5f6b0c --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 20 24))(end_p(""2 20 26)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 13))(end_p(""1 0 19)))))))(position((start_p(""1 0 6))(end_p(""1 0 19)))))))(position((start_p(""1 0 6))(end_p(""1 0 19))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 20 28))(end_p(""2 20 29)))))))(position((start_p(""2 20 28))(end_p(""2 20 29)))))((value(TyCon(TCon int)()))(position((start_p(""2 20 32))(end_p(""2 20 35)))))))(position((start_p(""2 20 27))(end_p(""2 20 36)))))((value(Variable((value(Id x))(position((start_p(""2 20 39))(end_p(""2 20 40)))))()))(position((start_p(""2 20 39))(end_p(""2 20 40)))))))))))(position((start_p(""1 0 0))(end_p(""2 20 40)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 42 46))(end_p(""4 42 50)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 42 53))(end_p(""4 42 56)))))))(position((start_p(""4 42 53))(end_p(""4 42 56))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""5 59 63))(end_p(""5 59 65)))))()))(position((start_p(""5 59 63))(end_p(""5 59 65)))))((value(Literal((value(LInt 42))(position((start_p(""5 59 67))(end_p(""5 59 69)))))))(position((start_p(""5 59 66))(end_p(""5 59 70)))))))(position((start_p(""5 59 63))(end_p(""5 59 70)))))))))(position((start_p(""4 42 42))(end_p(""5 59 70)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/11-function-definition.bad.typing.hopix.human-readable b/flap/tests/03-Typing/11-function-definition.bad.typing.hopix.human-readable new file mode 100644 index 0000000..55bed59 --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : int -> string + id (x : int) = x + +let main : int = + id (42) \ No newline at end of file diff --git a/flap/tests/03-Typing/11-function-definition.good.expected b/flap/tests/03-Typing/11-function-definition.good.expected new file mode 100644 index 0000000..4136dc0 --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.good.expected @@ -0,0 +1,2 @@ +id : int -> int +main : int diff --git a/flap/tests/03-Typing/11-function-definition.good.typing.hopix b/flap/tests/03-Typing/11-function-definition.good.typing.hopix new file mode 100644 index 0000000..ae5d5d9 --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 17 21))(end_p(""2 17 23)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 13))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 17 25))(end_p(""2 17 26)))))))(position((start_p(""2 17 25))(end_p(""2 17 26)))))((value(TyCon(TCon int)()))(position((start_p(""2 17 29))(end_p(""2 17 32)))))))(position((start_p(""2 17 24))(end_p(""2 17 33)))))((value(Variable((value(Id x))(position((start_p(""2 17 36))(end_p(""2 17 37)))))()))(position((start_p(""2 17 36))(end_p(""2 17 37)))))))))))(position((start_p(""1 0 0))(end_p(""2 17 37)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 39 43))(end_p(""4 39 47)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 39 50))(end_p(""4 39 53)))))))(position((start_p(""4 39 50))(end_p(""4 39 53))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""5 56 60))(end_p(""5 56 62)))))()))(position((start_p(""5 56 60))(end_p(""5 56 62)))))((value(Literal((value(LInt 42))(position((start_p(""5 56 64))(end_p(""5 56 66)))))))(position((start_p(""5 56 63))(end_p(""5 56 67)))))))(position((start_p(""5 56 60))(end_p(""5 56 67)))))))))(position((start_p(""4 39 39))(end_p(""5 56 67)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/11-function-definition.good.typing.hopix.human-readable b/flap/tests/03-Typing/11-function-definition.good.typing.hopix.human-readable new file mode 100644 index 0000000..1e5f4f7 --- /dev/null +++ b/flap/tests/03-Typing/11-function-definition.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : int -> int + id (x : int) = x + +let main : int = + id (42) diff --git a/flap/tests/03-Typing/12-rec-function-definition.bad.expected b/flap/tests/03-Typing/12-rec-function-definition.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix b/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix new file mode 100644 index 0000000..5e77c07 --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 17 20))(end_p(""2 17 22)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 13))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 17 24))(end_p(""2 17 25)))))))(position((start_p(""2 17 24))(end_p(""2 17 25)))))((value(TyCon(TCon int)()))(position((start_p(""2 17 28))(end_p(""2 17 31)))))))(position((start_p(""2 17 23))(end_p(""2 17 32)))))((value(Apply((value(Variable((value(Id id))(position((start_p(""2 17 35))(end_p(""2 17 37)))))()))(position((start_p(""2 17 35))(end_p(""2 17 37)))))((value(Variable((value(Id x))(position((start_p(""2 17 38))(end_p(""2 17 39)))))()))(position((start_p(""2 17 38))(end_p(""2 17 39)))))))(position((start_p(""2 17 35))(end_p(""2 17 39)))))))))))(position((start_p(""1 0 0))(end_p(""2 17 39)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 41 45))(end_p(""4 41 49)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 41 52))(end_p(""4 41 55)))))))(position((start_p(""4 41 52))(end_p(""4 41 55))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""5 58 62))(end_p(""5 58 64)))))()))(position((start_p(""5 58 62))(end_p(""5 58 64)))))((value(Literal((value(LString foo))(position((start_p(""5 58 69))(end_p(""5 58 70)))))))(position((start_p(""5 58 69))(end_p(""5 58 70)))))))(position((start_p(""5 58 62))(end_p(""5 58 70)))))))))(position((start_p(""4 41 41))(end_p(""5 58 70)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix.human-readable b/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix.human-readable new file mode 100644 index 0000000..8bc8619 --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : int -> int + id (x : int) = id x + +let main : int = + id "foo" \ No newline at end of file diff --git a/flap/tests/03-Typing/12-rec-function-definition.good.expected b/flap/tests/03-Typing/12-rec-function-definition.good.expected new file mode 100644 index 0000000..4136dc0 --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.good.expected @@ -0,0 +1,2 @@ +id : int -> int +main : int diff --git a/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix b/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix new file mode 100644 index 0000000..44ea197 --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 17 20))(end_p(""2 17 22)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 13))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 17 24))(end_p(""2 17 25)))))))(position((start_p(""2 17 24))(end_p(""2 17 25)))))((value(TyCon(TCon int)()))(position((start_p(""2 17 28))(end_p(""2 17 31)))))))(position((start_p(""2 17 23))(end_p(""2 17 32)))))((value(Apply((value(Variable((value(Id id))(position((start_p(""2 17 35))(end_p(""2 17 37)))))()))(position((start_p(""2 17 35))(end_p(""2 17 37)))))((value(Variable((value(Id x))(position((start_p(""2 17 38))(end_p(""2 17 39)))))()))(position((start_p(""2 17 38))(end_p(""2 17 39)))))))(position((start_p(""2 17 35))(end_p(""2 17 39)))))))))))(position((start_p(""1 0 0))(end_p(""2 17 39)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 41 45))(end_p(""4 41 49)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 41 52))(end_p(""4 41 55)))))))(position((start_p(""4 41 52))(end_p(""4 41 55))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""5 58 62))(end_p(""5 58 64)))))()))(position((start_p(""5 58 62))(end_p(""5 58 64)))))((value(Literal((value(LInt 42))(position((start_p(""5 58 65))(end_p(""5 58 67)))))))(position((start_p(""5 58 65))(end_p(""5 58 67)))))))(position((start_p(""5 58 62))(end_p(""5 58 67)))))))))(position((start_p(""4 41 41))(end_p(""5 58 67)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix.human-readable b/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix.human-readable new file mode 100644 index 0000000..57404ac --- /dev/null +++ b/flap/tests/03-Typing/12-rec-function-definition.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : int -> int + id (x : int) = id x + +let main : int = + id 42 \ No newline at end of file diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.expected b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.expected new file mode 100644 index 0000000..f48dd1a --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + This expression has type int which should be a function type. diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix new file mode 100644 index 0000000..ef5d11c --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id double_omega))(position((start_p(""2 17 21))(end_p(""2 17 33)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 13))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))(position((start_p(""2 17 35))(end_p(""2 17 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 17 39))(end_p(""2 17 42)))))))(position((start_p(""2 17 34))(end_p(""2 17 43)))))((value(Apply((value(Apply((value(Variable((value(Id omega))(position((start_p(""3 46 50))(end_p(""3 46 55)))))()))(position((start_p(""3 46 50))(end_p(""3 46 55)))))((value(Variable((value(Id x))(position((start_p(""3 46 57))(end_p(""3 46 58)))))()))(position((start_p(""3 46 56))(end_p(""3 46 59)))))))(position((start_p(""3 46 50))(end_p(""3 46 59)))))((value(Variable((value(Id x))(position((start_p(""3 46 61))(end_p(""3 46 62)))))()))(position((start_p(""3 46 60))(end_p(""3 46 63)))))))(position((start_p(""3 46 50))(end_p(""3 46 63)))))))(((value(Id omega))(position((start_p(""5 81 85))(end_p(""5 81 90)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""4 64 70))(end_p(""4 64 73)))))((value(TyCon(TCon int)()))(position((start_p(""4 64 77))(end_p(""4 64 80)))))))(position((start_p(""4 64 70))(end_p(""4 64 80)))))))(position((start_p(""4 64 70))(end_p(""4 64 80))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 81 92))(end_p(""5 81 93)))))))(position((start_p(""5 81 92))(end_p(""5 81 93)))))((value(TyCon(TCon int)()))(position((start_p(""5 81 95))(end_p(""5 81 98)))))))(position((start_p(""5 81 91))(end_p(""5 81 99)))))((value(Apply((value(Variable((value(Id double_omega))(position((start_p(""6 102 106))(end_p(""6 102 118)))))()))(position((start_p(""6 102 106))(end_p(""6 102 118)))))((value(Variable((value(Id x))(position((start_p(""6 102 120))(end_p(""6 102 121)))))()))(position((start_p(""6 102 119))(end_p(""6 102 122)))))))(position((start_p(""6 102 106))(end_p(""6 102 122)))))))))))(position((start_p(""1 0 0))(end_p(""6 102 122)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""8 124 128))(end_p(""8 124 132)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""8 124 135))(end_p(""8 124 138)))))))(position((start_p(""8 124 135))(end_p(""8 124 138))))))((value(Apply((value(Variable((value(Id double_omega))(position((start_p(""8 124 141))(end_p(""8 124 153)))))()))(position((start_p(""8 124 141))(end_p(""8 124 153)))))((value(Literal((value(LInt 73))(position((start_p(""8 124 154))(end_p(""8 124 156)))))))(position((start_p(""8 124 154))(end_p(""8 124 156)))))))(position((start_p(""8 124 141))(end_p(""8 124 156)))))))))(position((start_p(""8 124 124))(end_p(""8 124 156)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix.human-readable b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix.human-readable new file mode 100644 index 0000000..424067f --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.bad.typing.hopix.human-readable @@ -0,0 +1,8 @@ +fun : int -> int + double_omega (x : int) = + omega (x) (x) +and : int -> int + omega (x: int) = + double_omega (x) + +let main : int = double_omega 73 \ No newline at end of file diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.expected b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.expected new file mode 100644 index 0000000..c363346 --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.expected @@ -0,0 +1,3 @@ +double_omega : int -> int +omega : int -> int +main : int diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix new file mode 100644 index 0000000..e76b9fa --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id double_omega))(position((start_p(""2 17 21))(end_p(""2 17 33)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 13))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16)))))))(position((start_p(""1 0 6))(end_p(""1 0 16))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 17 35))(end_p(""2 17 36)))))))(position((start_p(""2 17 35))(end_p(""2 17 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 17 39))(end_p(""2 17 42)))))))(position((start_p(""2 17 34))(end_p(""2 17 43)))))((value(Apply((value(Variable((value(Id omega))(position((start_p(""3 46 50))(end_p(""3 46 55)))))()))(position((start_p(""3 46 50))(end_p(""3 46 55)))))((value(Variable((value(Id x))(position((start_p(""3 46 57))(end_p(""3 46 58)))))()))(position((start_p(""3 46 56))(end_p(""3 46 59)))))))(position((start_p(""3 46 50))(end_p(""3 46 59)))))))(((value(Id omega))(position((start_p(""5 77 81))(end_p(""5 77 86)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""4 60 66))(end_p(""4 60 69)))))((value(TyCon(TCon int)()))(position((start_p(""4 60 73))(end_p(""4 60 76)))))))(position((start_p(""4 60 66))(end_p(""4 60 76)))))))(position((start_p(""4 60 66))(end_p(""4 60 76))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 77 88))(end_p(""5 77 89)))))))(position((start_p(""5 77 88))(end_p(""5 77 89)))))((value(TyCon(TCon int)()))(position((start_p(""5 77 91))(end_p(""5 77 94)))))))(position((start_p(""5 77 87))(end_p(""5 77 95)))))((value(Apply((value(Variable((value(Id double_omega))(position((start_p(""6 98 102))(end_p(""6 98 114)))))()))(position((start_p(""6 98 102))(end_p(""6 98 114)))))((value(Variable((value(Id x))(position((start_p(""6 98 116))(end_p(""6 98 117)))))()))(position((start_p(""6 98 115))(end_p(""6 98 118)))))))(position((start_p(""6 98 102))(end_p(""6 98 118)))))))))))(position((start_p(""1 0 0))(end_p(""6 98 118)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""8 120 124))(end_p(""8 120 128)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""8 120 131))(end_p(""8 120 134)))))))(position((start_p(""8 120 131))(end_p(""8 120 134))))))((value(Apply((value(Variable((value(Id double_omega))(position((start_p(""8 120 137))(end_p(""8 120 149)))))()))(position((start_p(""8 120 137))(end_p(""8 120 149)))))((value(Literal((value(LInt 73))(position((start_p(""8 120 150))(end_p(""8 120 152)))))))(position((start_p(""8 120 150))(end_p(""8 120 152)))))))(position((start_p(""8 120 137))(end_p(""8 120 152)))))))))(position((start_p(""8 120 120))(end_p(""8 120 152)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix.human-readable b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix.human-readable new file mode 100644 index 0000000..a4e425f --- /dev/null +++ b/flap/tests/03-Typing/13-mutually-rec-fun-definitions.good.typing.hopix.human-readable @@ -0,0 +1,8 @@ +fun : int -> int + double_omega (x : int) = + omega (x) +and : int -> int + omega (x: int) = + double_omega (x) + +let main : int = double_omega 73 \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-function.bad.expected b/flap/tests/03-Typing/14-binary-function.bad.expected new file mode 100644 index 0000000..416dc3b --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int * int +Given: + int * int * int diff --git a/flap/tests/03-Typing/14-binary-function.bad.typing.hopix b/flap/tests/03-Typing/14-binary-function.bad.typing.hopix new file mode 100644 index 0000000..3486d6d --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 29))(end_p(""2 23 32)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 35))(end_p(""2 23 36)))))))(position((start_p(""2 23 35))(end_p(""2 23 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 39))(end_p(""2 23 42)))))))(position((start_p(""2 23 34))(end_p(""2 23 43)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 46))(end_p(""2 23 47)))))))(position((start_p(""2 23 46))(end_p(""2 23 47)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 50))(end_p(""2 23 53)))))))(position((start_p(""2 23 45))(end_p(""2 23 54))))))))(position((start_p(""2 23 33))(end_p(""2 23 55)))))((value(Variable((value(Id x))(position((start_p(""2 23 58))(end_p(""2 23 59)))))()))(position((start_p(""2 23 58))(end_p(""2 23 59)))))))))))(position((start_p(""1 0 0))(end_p(""2 23 59)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 61 65))(end_p(""4 61 69)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 61 72))(end_p(""4 61 75)))))))(position((start_p(""4 61 72))(end_p(""4 61 75))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""4 61 78))(end_p(""4 61 81)))))()))(position((start_p(""4 61 78))(end_p(""4 61 81)))))((value(Tuple(((value(Literal((value(LInt 3))(position((start_p(""4 61 83))(end_p(""4 61 84)))))))(position((start_p(""4 61 83))(end_p(""4 61 84)))))((value(Literal((value(LInt 4))(position((start_p(""4 61 86))(end_p(""4 61 87)))))))(position((start_p(""4 61 86))(end_p(""4 61 87)))))((value(Literal((value(LInt 4))(position((start_p(""4 61 89))(end_p(""4 61 90)))))))(position((start_p(""4 61 89))(end_p(""4 61 90))))))))(position((start_p(""4 61 82))(end_p(""4 61 91)))))))(position((start_p(""4 61 78))(end_p(""4 61 91)))))))))(position((start_p(""4 61 61))(end_p(""4 61 91)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/14-binary-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..dbeaf32 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = x + +let main : int = fst (3, 4, 4) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-function.good.expected b/flap/tests/03-Typing/14-binary-function.good.expected new file mode 100644 index 0000000..b2217a4 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.good.expected @@ -0,0 +1,2 @@ +fst : int * int -> int +main : int diff --git a/flap/tests/03-Typing/14-binary-function.good.typing.hopix b/flap/tests/03-Typing/14-binary-function.good.typing.hopix new file mode 100644 index 0000000..9b7e234 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 29))(end_p(""2 23 32)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 35))(end_p(""2 23 36)))))))(position((start_p(""2 23 35))(end_p(""2 23 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 39))(end_p(""2 23 42)))))))(position((start_p(""2 23 34))(end_p(""2 23 43)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 46))(end_p(""2 23 47)))))))(position((start_p(""2 23 46))(end_p(""2 23 47)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 50))(end_p(""2 23 53)))))))(position((start_p(""2 23 45))(end_p(""2 23 54))))))))(position((start_p(""2 23 33))(end_p(""2 23 55)))))((value(Variable((value(Id x))(position((start_p(""2 23 58))(end_p(""2 23 59)))))()))(position((start_p(""2 23 58))(end_p(""2 23 59)))))))))))(position((start_p(""1 0 0))(end_p(""2 23 59)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 61 65))(end_p(""4 61 69)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 61 72))(end_p(""4 61 75)))))))(position((start_p(""4 61 72))(end_p(""4 61 75))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""4 61 78))(end_p(""4 61 81)))))()))(position((start_p(""4 61 78))(end_p(""4 61 81)))))((value(Tuple(((value(Literal((value(LInt 3))(position((start_p(""4 61 83))(end_p(""4 61 84)))))))(position((start_p(""4 61 83))(end_p(""4 61 84)))))((value(Literal((value(LInt 4))(position((start_p(""4 61 86))(end_p(""4 61 87)))))))(position((start_p(""4 61 86))(end_p(""4 61 87))))))))(position((start_p(""4 61 82))(end_p(""4 61 88)))))))(position((start_p(""4 61 78))(end_p(""4 61 88)))))))))(position((start_p(""4 61 61))(end_p(""4 61 88)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/14-binary-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..b035446 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-function.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = x + +let main : int = fst (3, 4) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-rec-function.bad.expected b/flap/tests/03-Typing/14-binary-rec-function.bad.expected new file mode 100644 index 0000000..d8c7446 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int * int +Given: + int diff --git a/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix b/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix new file mode 100644 index 0000000..fe6131a --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 29))(end_p(""2 23 32)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 35))(end_p(""2 23 36)))))))(position((start_p(""2 23 35))(end_p(""2 23 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 39))(end_p(""2 23 42)))))))(position((start_p(""2 23 34))(end_p(""2 23 43)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 46))(end_p(""2 23 47)))))))(position((start_p(""2 23 46))(end_p(""2 23 47)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 50))(end_p(""2 23 53)))))))(position((start_p(""2 23 45))(end_p(""2 23 54))))))))(position((start_p(""2 23 33))(end_p(""2 23 55)))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""2 23 58))(end_p(""2 23 61)))))()))(position((start_p(""2 23 58))(end_p(""2 23 61)))))((value(Tuple(((value(Variable((value(Id y))(position((start_p(""2 23 63))(end_p(""2 23 64)))))()))(position((start_p(""2 23 63))(end_p(""2 23 64)))))((value(Variable((value(Id x))(position((start_p(""2 23 66))(end_p(""2 23 67)))))()))(position((start_p(""2 23 66))(end_p(""2 23 67))))))))(position((start_p(""2 23 62))(end_p(""2 23 68)))))))(position((start_p(""2 23 58))(end_p(""2 23 68)))))))))))(position((start_p(""1 0 0))(end_p(""2 23 68)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 70 74))(end_p(""4 70 78)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 70 81))(end_p(""4 70 84)))))))(position((start_p(""4 70 81))(end_p(""4 70 84))))))((value(Apply((value(Apply((value(Variable((value(Id fst))(position((start_p(""4 70 87))(end_p(""4 70 90)))))()))(position((start_p(""4 70 87))(end_p(""4 70 90)))))((value(Literal((value(LInt 3))(position((start_p(""4 70 91))(end_p(""4 70 92)))))))(position((start_p(""4 70 91))(end_p(""4 70 92)))))))(position((start_p(""4 70 87))(end_p(""4 70 92)))))((value(Literal((value(LInt 4))(position((start_p(""4 70 93))(end_p(""4 70 94)))))))(position((start_p(""4 70 93))(end_p(""4 70 94)))))))(position((start_p(""4 70 87))(end_p(""4 70 94)))))))))(position((start_p(""4 70 70))(end_p(""4 70 94)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..8479422 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = fst (y, x) + +let main : int = fst 3 4 \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-rec-function.good.expected b/flap/tests/03-Typing/14-binary-rec-function.good.expected new file mode 100644 index 0000000..b2217a4 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.good.expected @@ -0,0 +1,2 @@ +fst : int * int -> int +main : int diff --git a/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix b/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix new file mode 100644 index 0000000..99d0f58 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 29))(end_p(""2 23 32)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 35))(end_p(""2 23 36)))))))(position((start_p(""2 23 35))(end_p(""2 23 36)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 39))(end_p(""2 23 42)))))))(position((start_p(""2 23 34))(end_p(""2 23 43)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 46))(end_p(""2 23 47)))))))(position((start_p(""2 23 46))(end_p(""2 23 47)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 50))(end_p(""2 23 53)))))))(position((start_p(""2 23 45))(end_p(""2 23 54))))))))(position((start_p(""2 23 33))(end_p(""2 23 55)))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""2 23 58))(end_p(""2 23 61)))))()))(position((start_p(""2 23 58))(end_p(""2 23 61)))))((value(Tuple(((value(Variable((value(Id y))(position((start_p(""2 23 63))(end_p(""2 23 64)))))()))(position((start_p(""2 23 63))(end_p(""2 23 64)))))((value(Variable((value(Id x))(position((start_p(""2 23 66))(end_p(""2 23 67)))))()))(position((start_p(""2 23 66))(end_p(""2 23 67))))))))(position((start_p(""2 23 62))(end_p(""2 23 68)))))))(position((start_p(""2 23 58))(end_p(""2 23 68)))))))))))(position((start_p(""1 0 0))(end_p(""2 23 68)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 70 74))(end_p(""4 70 78)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 70 81))(end_p(""4 70 84)))))))(position((start_p(""4 70 81))(end_p(""4 70 84))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""4 70 87))(end_p(""4 70 90)))))()))(position((start_p(""4 70 87))(end_p(""4 70 90)))))((value(Tuple(((value(Literal((value(LInt 3))(position((start_p(""4 70 92))(end_p(""4 70 93)))))))(position((start_p(""4 70 92))(end_p(""4 70 93)))))((value(Literal((value(LInt 4))(position((start_p(""4 70 95))(end_p(""4 70 96)))))))(position((start_p(""4 70 95))(end_p(""4 70 96))))))))(position((start_p(""4 70 91))(end_p(""4 70 97)))))))(position((start_p(""4 70 87))(end_p(""4 70 97)))))))))(position((start_p(""4 70 70))(end_p(""4 70 97)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..80ffe56 --- /dev/null +++ b/flap/tests/03-Typing/14-binary-rec-function.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = fst (y, x) + +let main : int = fst (3, 4) \ No newline at end of file diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.expected b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.expected new file mode 100644 index 0000000..d8c7446 --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int * int +Given: + int diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix new file mode 100644 index 0000000..2f61b1c --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 27))(end_p(""2 23 30)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 33))(end_p(""2 23 34)))))))(position((start_p(""2 23 33))(end_p(""2 23 34)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 37))(end_p(""2 23 40)))))))(position((start_p(""2 23 32))(end_p(""2 23 41)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 44))(end_p(""2 23 45)))))))(position((start_p(""2 23 44))(end_p(""2 23 45)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 48))(end_p(""2 23 51)))))))(position((start_p(""2 23 43))(end_p(""2 23 52))))))))(position((start_p(""2 23 31))(end_p(""2 23 53)))))((value(Apply((value(Variable((value(Id snd))(position((start_p(""2 23 56))(end_p(""2 23 59)))))()))(position((start_p(""2 23 56))(end_p(""2 23 59)))))((value(Tuple(((value(Variable((value(Id y))(position((start_p(""2 23 61))(end_p(""2 23 62)))))()))(position((start_p(""2 23 61))(end_p(""2 23 62)))))((value(Variable((value(Id x))(position((start_p(""2 23 64))(end_p(""2 23 65)))))()))(position((start_p(""2 23 64))(end_p(""2 23 65))))))))(position((start_p(""2 23 60))(end_p(""2 23 66)))))))(position((start_p(""2 23 56))(end_p(""2 23 66)))))))(((value(Id snd))(position((start_p(""5 91 95))(end_p(""5 91 98)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""4 68 74))(end_p(""4 68 77)))))((value(TyCon(TCon int)()))(position((start_p(""4 68 80))(end_p(""4 68 83))))))))(position((start_p(""4 68 74))(end_p(""4 68 83)))))((value(TyCon(TCon int)()))(position((start_p(""4 68 87))(end_p(""4 68 90)))))))(position((start_p(""4 68 74))(end_p(""4 68 90)))))))(position((start_p(""4 68 74))(end_p(""4 68 90))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 91 101))(end_p(""5 91 102)))))))(position((start_p(""5 91 101))(end_p(""5 91 102)))))((value(TyCon(TCon int)()))(position((start_p(""5 91 105))(end_p(""5 91 108)))))))(position((start_p(""5 91 100))(end_p(""5 91 109)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""5 91 112))(end_p(""5 91 113)))))))(position((start_p(""5 91 112))(end_p(""5 91 113)))))((value(TyCon(TCon int)()))(position((start_p(""5 91 116))(end_p(""5 91 119)))))))(position((start_p(""5 91 111))(end_p(""5 91 120))))))))(position((start_p(""5 91 99))(end_p(""5 91 121)))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""5 91 124))(end_p(""5 91 127)))))()))(position((start_p(""5 91 124))(end_p(""5 91 127)))))((value(Tuple(((value(Variable((value(Id x))(position((start_p(""5 91 129))(end_p(""5 91 130)))))()))(position((start_p(""5 91 129))(end_p(""5 91 130)))))((value(Variable((value(Id y))(position((start_p(""5 91 132))(end_p(""5 91 133)))))()))(position((start_p(""5 91 132))(end_p(""5 91 133))))))))(position((start_p(""5 91 128))(end_p(""5 91 134)))))))(position((start_p(""5 91 124))(end_p(""5 91 134)))))))))))(position((start_p(""1 0 0))(end_p(""5 91 134)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""7 136 140))(end_p(""7 136 144)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""7 136 147))(end_p(""7 136 150)))))))(position((start_p(""7 136 147))(end_p(""7 136 150))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""7 136 153))(end_p(""7 136 156)))))()))(position((start_p(""7 136 153))(end_p(""7 136 156)))))((value(Literal((value(LInt 3))(position((start_p(""7 136 157))(end_p(""7 136 158)))))))(position((start_p(""7 136 157))(end_p(""7 136 158)))))))(position((start_p(""7 136 153))(end_p(""7 136 158)))))))))(position((start_p(""7 136 136))(end_p(""7 136 158)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..febfff5 --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = snd (y, x) + +and : int * int -> int + snd ((x : int), (y : int)) = fst (x, y) + +let main : int = fst 3 \ No newline at end of file diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.good.expected b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.expected new file mode 100644 index 0000000..06284d7 --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.expected @@ -0,0 +1,3 @@ +fst : int * int -> int +snd : int * int -> int +main : int diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix new file mode 100644 index 0000000..00ffcf0 --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 23 27))(end_p(""2 23 30)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""1 0 6))(end_p(""1 0 9)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 6))(end_p(""1 0 15)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22)))))))(position((start_p(""1 0 6))(end_p(""1 0 22))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 23 33))(end_p(""2 23 34)))))))(position((start_p(""2 23 33))(end_p(""2 23 34)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 37))(end_p(""2 23 40)))))))(position((start_p(""2 23 32))(end_p(""2 23 41)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 23 44))(end_p(""2 23 45)))))))(position((start_p(""2 23 44))(end_p(""2 23 45)))))((value(TyCon(TCon int)()))(position((start_p(""2 23 48))(end_p(""2 23 51)))))))(position((start_p(""2 23 43))(end_p(""2 23 52))))))))(position((start_p(""2 23 31))(end_p(""2 23 53)))))((value(Apply((value(Variable((value(Id snd))(position((start_p(""2 23 56))(end_p(""2 23 59)))))()))(position((start_p(""2 23 56))(end_p(""2 23 59)))))((value(Tuple(((value(Variable((value(Id y))(position((start_p(""2 23 61))(end_p(""2 23 62)))))()))(position((start_p(""2 23 61))(end_p(""2 23 62)))))((value(Variable((value(Id x))(position((start_p(""2 23 64))(end_p(""2 23 65)))))()))(position((start_p(""2 23 64))(end_p(""2 23 65))))))))(position((start_p(""2 23 60))(end_p(""2 23 66)))))))(position((start_p(""2 23 56))(end_p(""2 23 66)))))))(((value(Id snd))(position((start_p(""5 91 95))(end_p(""5 91 98)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyCon(TCon int)()))(position((start_p(""4 68 74))(end_p(""4 68 77)))))((value(TyCon(TCon int)()))(position((start_p(""4 68 80))(end_p(""4 68 83))))))))(position((start_p(""4 68 74))(end_p(""4 68 83)))))((value(TyCon(TCon int)()))(position((start_p(""4 68 87))(end_p(""4 68 90)))))))(position((start_p(""4 68 74))(end_p(""4 68 90)))))))(position((start_p(""4 68 74))(end_p(""4 68 90))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 91 101))(end_p(""5 91 102)))))))(position((start_p(""5 91 101))(end_p(""5 91 102)))))((value(TyCon(TCon int)()))(position((start_p(""5 91 105))(end_p(""5 91 108)))))))(position((start_p(""5 91 100))(end_p(""5 91 109)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""5 91 112))(end_p(""5 91 113)))))))(position((start_p(""5 91 112))(end_p(""5 91 113)))))((value(TyCon(TCon int)()))(position((start_p(""5 91 116))(end_p(""5 91 119)))))))(position((start_p(""5 91 111))(end_p(""5 91 120))))))))(position((start_p(""5 91 99))(end_p(""5 91 121)))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""5 91 124))(end_p(""5 91 127)))))()))(position((start_p(""5 91 124))(end_p(""5 91 127)))))((value(Tuple(((value(Variable((value(Id x))(position((start_p(""5 91 129))(end_p(""5 91 130)))))()))(position((start_p(""5 91 129))(end_p(""5 91 130)))))((value(Variable((value(Id y))(position((start_p(""5 91 132))(end_p(""5 91 133)))))()))(position((start_p(""5 91 132))(end_p(""5 91 133))))))))(position((start_p(""5 91 128))(end_p(""5 91 134)))))))(position((start_p(""5 91 124))(end_p(""5 91 134)))))))))))(position((start_p(""1 0 0))(end_p(""5 91 134)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""7 136 140))(end_p(""7 136 144)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""7 136 147))(end_p(""7 136 150)))))))(position((start_p(""7 136 147))(end_p(""7 136 150))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""7 136 153))(end_p(""7 136 156)))))()))(position((start_p(""7 136 153))(end_p(""7 136 156)))))((value(Tuple(((value(Literal((value(LInt 3))(position((start_p(""7 136 158))(end_p(""7 136 159)))))))(position((start_p(""7 136 158))(end_p(""7 136 159)))))((value(Literal((value(LInt 4))(position((start_p(""7 136 161))(end_p(""7 136 162)))))))(position((start_p(""7 136 161))(end_p(""7 136 162))))))))(position((start_p(""7 136 157))(end_p(""7 136 163)))))))(position((start_p(""7 136 153))(end_p(""7 136 163)))))))))(position((start_p(""7 136 136))(end_p(""7 136 163)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..f381853 --- /dev/null +++ b/flap/tests/03-Typing/15-binary-mutually-rec-function.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +fun : int * int -> int + fst ((x : int), (y : int)) = snd (y, x) + +and : int * int -> int + snd ((x : int), (y : int)) = fst (x, y) + +let main : int = fst (3, 4) \ No newline at end of file diff --git a/flap/tests/03-Typing/16-polymorphic-function.bad.expected b/flap/tests/03-Typing/16-polymorphic-function.bad.expected new file mode 100644 index 0000000..9bc6c30 --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `a +Given: + int diff --git a/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix b/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix new file mode 100644 index 0000000..115910e --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 20 26))(end_p(""2 20 28)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 11))(end_p(""1 0 13)))))((value(TyVar(TId `a)))(position((start_p(""1 0 17))(end_p(""1 0 19)))))))(position((start_p(""1 0 11))(end_p(""1 0 19)))))))(position((start_p(""1 0 6))(end_p(""1 0 19))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 20 30))(end_p(""2 20 31)))))))(position((start_p(""2 20 30))(end_p(""2 20 31)))))((value(TyCon(TCon int)()))(position((start_p(""2 20 34))(end_p(""2 20 37)))))))(position((start_p(""2 20 29))(end_p(""2 20 38)))))((value(Variable((value(Id x))(position((start_p(""2 20 41))(end_p(""2 20 42)))))()))(position((start_p(""2 20 41))(end_p(""2 20 42)))))))))))(position((start_p(""1 0 0))(end_p(""2 20 42)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 44 48))(end_p(""4 44 52)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 44 55))(end_p(""4 44 58)))))))(position((start_p(""4 44 55))(end_p(""4 44 58))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""4 44 61))(end_p(""4 44 63)))))((((value(TyCon(TCon int)()))(position((start_p(""4 44 64))(end_p(""4 44 67)))))))))(position((start_p(""4 44 61))(end_p(""4 44 68)))))((value(Literal((value(LInt 37))(position((start_p(""4 44 70))(end_p(""4 44 72)))))))(position((start_p(""4 44 69))(end_p(""4 44 73)))))))(position((start_p(""4 44 61))(end_p(""4 44 73)))))))))(position((start_p(""4 44 44))(end_p(""4 44 73)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..e579570 --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : [`a] `a -> `a + id (x : int) = x + +let main : int = id (37) \ No newline at end of file diff --git a/flap/tests/03-Typing/16-polymorphic-function.good.expected b/flap/tests/03-Typing/16-polymorphic-function.good.expected new file mode 100644 index 0000000..a1dff99 --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.good.expected @@ -0,0 +1,2 @@ +id : [`a] `a -> `a +main : int diff --git a/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix b/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix new file mode 100644 index 0000000..f0f8651 --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id id))(position((start_p(""2 20 26))(end_p(""2 20 28)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 11))(end_p(""1 0 13)))))((value(TyVar(TId `a)))(position((start_p(""1 0 17))(end_p(""1 0 19)))))))(position((start_p(""1 0 11))(end_p(""1 0 19)))))))(position((start_p(""1 0 6))(end_p(""1 0 19))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 20 30))(end_p(""2 20 31)))))))(position((start_p(""2 20 30))(end_p(""2 20 31)))))((value(TyVar(TId `a)))(position((start_p(""2 20 34))(end_p(""2 20 36)))))))(position((start_p(""2 20 29))(end_p(""2 20 37)))))((value(Variable((value(Id x))(position((start_p(""2 20 40))(end_p(""2 20 41)))))()))(position((start_p(""2 20 40))(end_p(""2 20 41)))))))))))(position((start_p(""1 0 0))(end_p(""2 20 41)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 43 47))(end_p(""4 43 51)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 43 54))(end_p(""4 43 57)))))))(position((start_p(""4 43 54))(end_p(""4 43 57))))))((value(Apply((value(Variable((value(Id id))(position((start_p(""4 43 60))(end_p(""4 43 62)))))((((value(TyCon(TCon int)()))(position((start_p(""4 43 63))(end_p(""4 43 66)))))))))(position((start_p(""4 43 60))(end_p(""4 43 67)))))((value(Literal((value(LInt 37))(position((start_p(""4 43 69))(end_p(""4 43 71)))))))(position((start_p(""4 43 68))(end_p(""4 43 72)))))))(position((start_p(""4 43 60))(end_p(""4 43 72)))))))))(position((start_p(""4 43 43))(end_p(""4 43 72)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..5ae687b --- /dev/null +++ b/flap/tests/03-Typing/16-polymorphic-function.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +fun : [`a] `a -> `a + id (x : `a) = x + +let main : int = id (37) \ No newline at end of file diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.bad.expected b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.expected new file mode 100644 index 0000000..225abb0 --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `a +Given: + `b diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix new file mode 100644 index 0000000..0f8f50c --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 29 35))(end_p(""2 29 38)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 20))(end_p(""1 0 22))))))))(position((start_p(""1 0 15))(end_p(""1 0 22)))))((value(TyVar(TId `a)))(position((start_p(""1 0 26))(end_p(""1 0 28)))))))(position((start_p(""1 0 15))(end_p(""1 0 28)))))))(position((start_p(""1 0 6))(end_p(""1 0 28))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 29 41))(end_p(""2 29 42)))))))(position((start_p(""2 29 41))(end_p(""2 29 42)))))((value(TyVar(TId `b)))(position((start_p(""2 29 45))(end_p(""2 29 47)))))))(position((start_p(""2 29 40))(end_p(""2 29 48)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 29 51))(end_p(""2 29 52)))))))(position((start_p(""2 29 51))(end_p(""2 29 52)))))((value(TyVar(TId `a)))(position((start_p(""2 29 55))(end_p(""2 29 57)))))))(position((start_p(""2 29 50))(end_p(""2 29 58))))))))(position((start_p(""2 29 39))(end_p(""2 29 59)))))((value(Variable((value(Id x))(position((start_p(""2 29 62))(end_p(""2 29 63)))))()))(position((start_p(""2 29 62))(end_p(""2 29 63)))))))))))(position((start_p(""1 0 0))(end_p(""2 29 63)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 65 69))(end_p(""4 65 73)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 65 76))(end_p(""4 65 79)))))))(position((start_p(""4 65 76))(end_p(""4 65 79))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""5 82 86))(end_p(""5 82 89)))))((((value(TyCon(TCon int)()))(position((start_p(""5 82 90))(end_p(""5 82 93)))))((value(TyCon(TCon char)()))(position((start_p(""5 82 95))(end_p(""5 82 99)))))))))(position((start_p(""5 82 86))(end_p(""5 82 100)))))((value(Tuple(((value(Literal((value(LInt 37))(position((start_p(""5 82 102))(end_p(""5 82 104)))))))(position((start_p(""5 82 102))(end_p(""5 82 104)))))((value(Literal((value(LChar a))(position((start_p(""5 82 106))(end_p(""5 82 109)))))))(position((start_p(""5 82 106))(end_p(""5 82 109))))))))(position((start_p(""5 82 101))(end_p(""5 82 110)))))))(position((start_p(""5 82 86))(end_p(""5 82 110)))))))))(position((start_p(""4 65 65))(end_p(""5 82 110)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..f1319a3 --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] `a * `b -> `a + fst ((x : `b), (y : `a)) = x + +let main : int = + fst (37, 'a') \ No newline at end of file diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.good.expected b/flap/tests/03-Typing/17-polymorphic-binary-function.good.expected new file mode 100644 index 0000000..34b75c1 --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.good.expected @@ -0,0 +1,2 @@ +fst : [`a, `b] `a * `b -> `a +main : int diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix b/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix new file mode 100644 index 0000000..a2bcaf2 --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fst))(position((start_p(""2 29 35))(end_p(""2 29 38)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 20))(end_p(""1 0 22))))))))(position((start_p(""1 0 15))(end_p(""1 0 22)))))((value(TyVar(TId `a)))(position((start_p(""1 0 26))(end_p(""1 0 28)))))))(position((start_p(""1 0 15))(end_p(""1 0 28)))))))(position((start_p(""1 0 6))(end_p(""1 0 28))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 29 41))(end_p(""2 29 42)))))))(position((start_p(""2 29 41))(end_p(""2 29 42)))))((value(TyVar(TId `a)))(position((start_p(""2 29 45))(end_p(""2 29 47)))))))(position((start_p(""2 29 40))(end_p(""2 29 48)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""2 29 51))(end_p(""2 29 52)))))))(position((start_p(""2 29 51))(end_p(""2 29 52)))))((value(TyVar(TId `b)))(position((start_p(""2 29 55))(end_p(""2 29 57)))))))(position((start_p(""2 29 50))(end_p(""2 29 58))))))))(position((start_p(""2 29 39))(end_p(""2 29 59)))))((value(Variable((value(Id x))(position((start_p(""2 29 62))(end_p(""2 29 63)))))()))(position((start_p(""2 29 62))(end_p(""2 29 63)))))))))))(position((start_p(""1 0 0))(end_p(""2 29 63)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 65 69))(end_p(""4 65 73)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 65 76))(end_p(""4 65 79)))))))(position((start_p(""4 65 76))(end_p(""4 65 79))))))((value(Apply((value(Variable((value(Id fst))(position((start_p(""5 82 86))(end_p(""5 82 89)))))((((value(TyCon(TCon int)()))(position((start_p(""5 82 90))(end_p(""5 82 93)))))((value(TyCon(TCon char)()))(position((start_p(""5 82 95))(end_p(""5 82 99)))))))))(position((start_p(""5 82 86))(end_p(""5 82 100)))))((value(Tuple(((value(Literal((value(LInt 37))(position((start_p(""5 82 102))(end_p(""5 82 104)))))))(position((start_p(""5 82 102))(end_p(""5 82 104)))))((value(Literal((value(LChar a))(position((start_p(""5 82 106))(end_p(""5 82 109)))))))(position((start_p(""5 82 106))(end_p(""5 82 109))))))))(position((start_p(""5 82 101))(end_p(""5 82 110)))))))(position((start_p(""5 82 86))(end_p(""5 82 110)))))))))(position((start_p(""4 65 65))(end_p(""5 82 110)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..5ac3fa4 --- /dev/null +++ b/flap/tests/03-Typing/17-polymorphic-binary-function.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] `a * `b -> `a + fst ((x : `a), (y : `b)) = x + +let main : int = + fst (37, 'a') \ No newline at end of file diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.expected b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.expected new file mode 100644 index 0000000..af772b3 --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `b +Given: + `a diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix new file mode 100644 index 0000000..92f6a0a --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id false_rec))(position((start_p(""2 24 28))(end_p(""2 24 37)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 21))(end_p(""1 0 23)))))))(position((start_p(""1 0 15))(end_p(""1 0 23)))))))(position((start_p(""1 0 6))(end_p(""1 0 23))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 24 39))(end_p(""2 24 40)))))))(position((start_p(""2 24 39))(end_p(""2 24 40)))))((value(TyVar(TId `a)))(position((start_p(""2 24 43))(end_p(""2 24 45)))))))(position((start_p(""2 24 38))(end_p(""2 24 46)))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""2 24 49))(end_p(""2 24 58)))))((((value(TyVar(TId `a)))(position((start_p(""2 24 59))(end_p(""2 24 61)))))((value(TyVar(TId `a)))(position((start_p(""2 24 63))(end_p(""2 24 65)))))))))(position((start_p(""2 24 49))(end_p(""2 24 66)))))((value(Variable((value(Id x))(position((start_p(""2 24 68))(end_p(""2 24 69)))))()))(position((start_p(""2 24 67))(end_p(""2 24 70)))))))(position((start_p(""2 24 49))(end_p(""2 24 70)))))))))))(position((start_p(""1 0 0))(end_p(""2 24 70)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 72 76))(end_p(""4 72 80)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""4 72 83))(end_p(""4 72 89)))))))(position((start_p(""4 72 83))(end_p(""4 72 89))))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""5 92 96))(end_p(""5 92 105)))))((((value(TyCon(TCon int)()))(position((start_p(""5 92 106))(end_p(""5 92 109)))))((value(TyCon(TCon string)()))(position((start_p(""5 92 111))(end_p(""5 92 117)))))))))(position((start_p(""5 92 96))(end_p(""5 92 118)))))((value(Literal((value(LInt 33))(position((start_p(""5 92 119))(end_p(""5 92 121)))))))(position((start_p(""5 92 118))(end_p(""5 92 122)))))))(position((start_p(""5 92 96))(end_p(""5 92 122)))))))))(position((start_p(""4 72 72))(end_p(""5 92 122)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..f8c6365 --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] `a -> `b + false_rec (x : `a) = false_rec<`a, `a> (x) + +let main : string = + false_rec(33) \ No newline at end of file diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.good.expected b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.expected new file mode 100644 index 0000000..553ea9c --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.expected @@ -0,0 +1,2 @@ +false_rec : [`a, `b] `a -> `b +main : string diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix new file mode 100644 index 0000000..7c7e1d8 --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id false_rec))(position((start_p(""2 24 28))(end_p(""2 24 37)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 21))(end_p(""1 0 23)))))))(position((start_p(""1 0 15))(end_p(""1 0 23)))))))(position((start_p(""1 0 6))(end_p(""1 0 23))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 24 39))(end_p(""2 24 40)))))))(position((start_p(""2 24 39))(end_p(""2 24 40)))))((value(TyVar(TId `a)))(position((start_p(""2 24 43))(end_p(""2 24 45)))))))(position((start_p(""2 24 38))(end_p(""2 24 46)))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""2 24 49))(end_p(""2 24 58)))))((((value(TyVar(TId `a)))(position((start_p(""2 24 59))(end_p(""2 24 61)))))((value(TyVar(TId `b)))(position((start_p(""2 24 63))(end_p(""2 24 65)))))))))(position((start_p(""2 24 49))(end_p(""2 24 66)))))((value(Variable((value(Id x))(position((start_p(""2 24 68))(end_p(""2 24 69)))))()))(position((start_p(""2 24 67))(end_p(""2 24 70)))))))(position((start_p(""2 24 49))(end_p(""2 24 70)))))))))))(position((start_p(""1 0 0))(end_p(""2 24 70)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""4 72 76))(end_p(""4 72 80)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""4 72 83))(end_p(""4 72 89)))))))(position((start_p(""4 72 83))(end_p(""4 72 89))))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""5 92 96))(end_p(""5 92 105)))))((((value(TyCon(TCon int)()))(position((start_p(""5 92 106))(end_p(""5 92 109)))))((value(TyCon(TCon string)()))(position((start_p(""5 92 111))(end_p(""5 92 117)))))))))(position((start_p(""5 92 96))(end_p(""5 92 118)))))((value(Literal((value(LInt 33))(position((start_p(""5 92 119))(end_p(""5 92 121)))))))(position((start_p(""5 92 118))(end_p(""5 92 122)))))))(position((start_p(""5 92 96))(end_p(""5 92 122)))))))))(position((start_p(""4 72 72))(end_p(""5 92 122)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..cc39ee4 --- /dev/null +++ b/flap/tests/03-Typing/18-polymorphic-recursive-function.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] `a -> `b + false_rec (x : `a) = false_rec<`a, `b> (x) + +let main : string = + false_rec(33) \ No newline at end of file diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.expected b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.expected new file mode 100644 index 0000000..af772b3 --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `b +Given: + `a diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix new file mode 100644 index 0000000..9898652 --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id false_rec))(position((start_p(""2 24 28))(end_p(""2 24 37)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 21))(end_p(""1 0 23)))))))(position((start_p(""1 0 15))(end_p(""1 0 23)))))))(position((start_p(""1 0 6))(end_p(""1 0 23))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 24 39))(end_p(""2 24 40)))))))(position((start_p(""2 24 39))(end_p(""2 24 40)))))((value(TyVar(TId `a)))(position((start_p(""2 24 43))(end_p(""2 24 45)))))))(position((start_p(""2 24 38))(end_p(""2 24 46)))))((value(Apply((value(Variable((value(Id false_rec2))(position((start_p(""2 24 49))(end_p(""2 24 59)))))((((value(TyVar(TId `b)))(position((start_p(""2 24 60))(end_p(""2 24 62)))))((value(TyVar(TId `a)))(position((start_p(""2 24 64))(end_p(""2 24 66)))))))))(position((start_p(""2 24 49))(end_p(""2 24 67)))))((value(Variable((value(Id x))(position((start_p(""2 24 69))(end_p(""2 24 70)))))()))(position((start_p(""2 24 68))(end_p(""2 24 71)))))))(position((start_p(""2 24 49))(end_p(""2 24 71)))))))(((value(Id false_rec2))(position((start_p(""5 97 101))(end_p(""5 97 111)))))(((value(ForallTy(((value(TId `a))(position((start_p(""4 73 80))(end_p(""4 73 82)))))((value(TId `b))(position((start_p(""4 73 84))(end_p(""4 73 86))))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 73 88))(end_p(""4 73 90)))))((value(TyVar(TId `b)))(position((start_p(""4 73 94))(end_p(""4 73 96)))))))(position((start_p(""4 73 88))(end_p(""4 73 96)))))))(position((start_p(""4 73 79))(end_p(""4 73 96))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 97 113))(end_p(""5 97 114)))))))(position((start_p(""5 97 113))(end_p(""5 97 114)))))((value(TyVar(TId `b)))(position((start_p(""5 97 117))(end_p(""5 97 119)))))))(position((start_p(""5 97 112))(end_p(""5 97 120)))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""5 97 123))(end_p(""5 97 132)))))((((value(TyVar(TId `b)))(position((start_p(""5 97 133))(end_p(""5 97 135)))))((value(TyVar(TId `a)))(position((start_p(""5 97 137))(end_p(""5 97 139)))))))))(position((start_p(""5 97 123))(end_p(""5 97 140)))))((value(Variable((value(Id x))(position((start_p(""5 97 142))(end_p(""5 97 143)))))()))(position((start_p(""5 97 141))(end_p(""5 97 144)))))))(position((start_p(""5 97 123))(end_p(""5 97 144)))))))))))(position((start_p(""1 0 0))(end_p(""5 97 144)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""7 146 150))(end_p(""7 146 154)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 146 157))(end_p(""7 146 163)))))))(position((start_p(""7 146 157))(end_p(""7 146 163))))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""7 146 166))(end_p(""7 146 175)))))((((value(TyCon(TCon int)()))(position((start_p(""7 146 176))(end_p(""7 146 179)))))((value(TyCon(TCon string)()))(position((start_p(""7 146 181))(end_p(""7 146 187)))))))))(position((start_p(""7 146 166))(end_p(""7 146 188)))))((value(Literal((value(LInt 43))(position((start_p(""7 146 190))(end_p(""7 146 192)))))))(position((start_p(""7 146 189))(end_p(""7 146 193)))))))(position((start_p(""7 146 166))(end_p(""7 146 193)))))))))(position((start_p(""7 146 146))(end_p(""7 146 193)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix.human-readable b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix.human-readable new file mode 100644 index 0000000..5d8d048 --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +fun : [`a, `b] `a -> `b + false_rec (x : `a) = false_rec2<`b, `a> (x) + +and : [`a, `b] `b -> `b + false_rec2 (x : `b) = false_rec<`b, `a> (x) + +let main : string = false_rec (43) diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.expected b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.expected new file mode 100644 index 0000000..e902b38 --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.expected @@ -0,0 +1,3 @@ +false_rec : [`a, `b] `a -> `b +false_rec2 : [`b, `a] `a -> `b +main : string diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix new file mode 100644 index 0000000..3440b56 --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id false_rec))(position((start_p(""2 24 28))(end_p(""2 24 37)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 15))(end_p(""1 0 17)))))((value(TyVar(TId `b)))(position((start_p(""1 0 21))(end_p(""1 0 23)))))))(position((start_p(""1 0 15))(end_p(""1 0 23)))))))(position((start_p(""1 0 6))(end_p(""1 0 23))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 24 39))(end_p(""2 24 40)))))))(position((start_p(""2 24 39))(end_p(""2 24 40)))))((value(TyVar(TId `a)))(position((start_p(""2 24 43))(end_p(""2 24 45)))))))(position((start_p(""2 24 38))(end_p(""2 24 46)))))((value(Apply((value(Variable((value(Id false_rec2))(position((start_p(""2 24 49))(end_p(""2 24 59)))))((((value(TyVar(TId `b)))(position((start_p(""2 24 60))(end_p(""2 24 62)))))((value(TyVar(TId `a)))(position((start_p(""2 24 64))(end_p(""2 24 66)))))))))(position((start_p(""2 24 49))(end_p(""2 24 67)))))((value(Variable((value(Id x))(position((start_p(""2 24 69))(end_p(""2 24 70)))))()))(position((start_p(""2 24 68))(end_p(""2 24 71)))))))(position((start_p(""2 24 49))(end_p(""2 24 71)))))))(((value(Id false_rec2))(position((start_p(""5 97 101))(end_p(""5 97 111)))))(((value(ForallTy(((value(TId `a))(position((start_p(""4 73 80))(end_p(""4 73 82)))))((value(TId `b))(position((start_p(""4 73 84))(end_p(""4 73 86))))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 73 88))(end_p(""4 73 90)))))((value(TyVar(TId `a)))(position((start_p(""4 73 94))(end_p(""4 73 96)))))))(position((start_p(""4 73 88))(end_p(""4 73 96)))))))(position((start_p(""4 73 79))(end_p(""4 73 96))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 97 113))(end_p(""5 97 114)))))))(position((start_p(""5 97 113))(end_p(""5 97 114)))))((value(TyVar(TId `b)))(position((start_p(""5 97 117))(end_p(""5 97 119)))))))(position((start_p(""5 97 112))(end_p(""5 97 120)))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""5 97 123))(end_p(""5 97 132)))))((((value(TyVar(TId `b)))(position((start_p(""5 97 133))(end_p(""5 97 135)))))((value(TyVar(TId `a)))(position((start_p(""5 97 137))(end_p(""5 97 139)))))))))(position((start_p(""5 97 123))(end_p(""5 97 140)))))((value(Variable((value(Id x))(position((start_p(""5 97 142))(end_p(""5 97 143)))))()))(position((start_p(""5 97 141))(end_p(""5 97 144)))))))(position((start_p(""5 97 123))(end_p(""5 97 144)))))))))))(position((start_p(""1 0 0))(end_p(""5 97 144)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""7 146 150))(end_p(""7 146 154)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 146 157))(end_p(""7 146 163)))))))(position((start_p(""7 146 157))(end_p(""7 146 163))))))((value(Apply((value(Variable((value(Id false_rec))(position((start_p(""7 146 166))(end_p(""7 146 175)))))((((value(TyCon(TCon int)()))(position((start_p(""7 146 176))(end_p(""7 146 179)))))((value(TyCon(TCon string)()))(position((start_p(""7 146 181))(end_p(""7 146 187)))))))))(position((start_p(""7 146 166))(end_p(""7 146 188)))))((value(Literal((value(LInt 43))(position((start_p(""7 146 190))(end_p(""7 146 192)))))))(position((start_p(""7 146 189))(end_p(""7 146 193)))))))(position((start_p(""7 146 166))(end_p(""7 146 193)))))))))(position((start_p(""7 146 146))(end_p(""7 146 193)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix.human-readable b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix.human-readable new file mode 100644 index 0000000..ff7ac4d --- /dev/null +++ b/flap/tests/03-Typing/19-polymorphic-mutually-recursive-functions.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +fun : [`a, `b] `a -> `b + false_rec (x : `a) = false_rec2<`b, `a> (x) + +and : [`a, `b] `b -> `a + false_rec2 (x : `b) = false_rec<`b, `a> (x) + +let main : string = false_rec (43) diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.bad.expected b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.expected new file mode 100644 index 0000000..0ac19fd --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `b -> (`a -> `c) +Given: + `a -> (`b -> `c) diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix new file mode 100644 index 0000000..2da13d6 --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id apply))(position((start_p(""2 37 41))(end_p(""2 37 46)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyTuple(((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 16))(end_p(""1 0 18)))))((value(TyVar(TId `b)))(position((start_p(""1 0 22))(end_p(""1 0 24)))))))(position((start_p(""1 0 15))(end_p(""1 0 25)))))((value(TyVar(TId `a)))(position((start_p(""1 0 28))(end_p(""1 0 30))))))))(position((start_p(""1 0 15))(end_p(""1 0 30)))))((value(TyVar(TId `b)))(position((start_p(""1 0 34))(end_p(""1 0 36)))))))(position((start_p(""1 0 15))(end_p(""1 0 36)))))))(position((start_p(""1 0 6))(end_p(""1 0 36))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 37 49))(end_p(""2 37 50)))))))(position((start_p(""2 37 49))(end_p(""2 37 50)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 37 53))(end_p(""2 37 55)))))((value(TyVar(TId `b)))(position((start_p(""2 37 59))(end_p(""2 37 61)))))))(position((start_p(""2 37 53))(end_p(""2 37 61)))))))(position((start_p(""2 37 48))(end_p(""2 37 62)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 37 65))(end_p(""2 37 66)))))))(position((start_p(""2 37 65))(end_p(""2 37 66)))))((value(TyVar(TId `a)))(position((start_p(""2 37 69))(end_p(""2 37 71)))))))(position((start_p(""2 37 64))(end_p(""2 37 72))))))))(position((start_p(""2 37 47))(end_p(""2 37 73)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""2 37 76))(end_p(""2 37 77)))))()))(position((start_p(""2 37 76))(end_p(""2 37 77)))))((value(Variable((value(Id x))(position((start_p(""2 37 79))(end_p(""2 37 80)))))()))(position((start_p(""2 37 78))(end_p(""2 37 81)))))))(position((start_p(""2 37 76))(end_p(""2 37 81)))))))))))(position((start_p(""1 0 0))(end_p(""2 37 81)))))((value(DefineValue(RecFunctions((((value(Id curry))(position((start_p(""5 138 142))(end_p(""5 138 147)))))(((value(ForallTy(((value(TId `a))(position((start_p(""4 83 90))(end_p(""4 83 92)))))((value(TId `b))(position((start_p(""4 83 94))(end_p(""4 83 96)))))((value(TId `c))(position((start_p(""4 83 98))(end_p(""4 83 100))))))((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""4 83 103))(end_p(""4 83 105)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 83 109))(end_p(""4 83 111)))))((value(TyVar(TId `c)))(position((start_p(""4 83 115))(end_p(""4 83 117)))))))(position((start_p(""4 83 109))(end_p(""4 83 117)))))))(position((start_p(""4 83 102))(end_p(""4 83 118)))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""4 83 123))(end_p(""4 83 125)))))((value(TyVar(TId `b)))(position((start_p(""4 83 128))(end_p(""4 83 130))))))))(position((start_p(""4 83 123))(end_p(""4 83 130)))))((value(TyVar(TId `c)))(position((start_p(""4 83 134))(end_p(""4 83 136)))))))(position((start_p(""4 83 122))(end_p(""4 83 137)))))))(position((start_p(""4 83 102))(end_p(""4 83 137)))))))(position((start_p(""4 83 89))(end_p(""4 83 137))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""5 138 149))(end_p(""5 138 150)))))))(position((start_p(""5 138 149))(end_p(""5 138 150)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""5 138 153))(end_p(""5 138 155)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""5 138 159))(end_p(""5 138 161)))))((value(TyVar(TId `c)))(position((start_p(""5 138 165))(end_p(""5 138 167)))))))(position((start_p(""5 138 159))(end_p(""5 138 167)))))))(position((start_p(""5 138 153))(end_p(""5 138 167)))))))(position((start_p(""5 138 148))(end_p(""5 138 168)))))((value(Define(RecFunctions((((value(Id fc))(position((start_p(""7 195 203))(end_p(""7 195 205)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""6 171 181))(end_p(""6 171 183)))))((value(TyVar(TId `b)))(position((start_p(""6 171 186))(end_p(""6 171 188))))))))(position((start_p(""6 171 181))(end_p(""6 171 188)))))((value(TyVar(TId `c)))(position((start_p(""6 171 192))(end_p(""6 171 194)))))))(position((start_p(""6 171 181))(end_p(""6 171 194)))))))(position((start_p(""6 171 181))(end_p(""6 171 194))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""7 195 208))(end_p(""7 195 209)))))))(position((start_p(""7 195 208))(end_p(""7 195 209)))))((value(TyVar(TId `a)))(position((start_p(""7 195 211))(end_p(""7 195 213)))))))(position((start_p(""7 195 207))(end_p(""7 195 214)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""7 195 217))(end_p(""7 195 218)))))))(position((start_p(""7 195 217))(end_p(""7 195 218)))))((value(TyVar(TId `b)))(position((start_p(""7 195 221))(end_p(""7 195 223)))))))(position((start_p(""7 195 216))(end_p(""7 195 224))))))))(position((start_p(""7 195 206))(end_p(""7 195 225)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""7 195 229))(end_p(""7 195 230)))))()))(position((start_p(""7 195 229))(end_p(""7 195 230)))))((value(Variable((value(Id x))(position((start_p(""7 195 232))(end_p(""7 195 233)))))()))(position((start_p(""7 195 231))(end_p(""7 195 234)))))))(position((start_p(""7 195 228))(end_p(""7 195 235)))))((value(Variable((value(Id y))(position((start_p(""7 195 237))(end_p(""7 195 238)))))()))(position((start_p(""7 195 236))(end_p(""7 195 239)))))))(position((start_p(""7 195 228))(end_p(""7 195 239)))))))))((value(Variable((value(Id fc))(position((start_p(""8 241 245))(end_p(""8 241 247)))))()))(position((start_p(""8 241 245))(end_p(""8 241 247)))))))(position((start_p(""6 171 175))(end_p(""8 241 247)))))))))))(position((start_p(""4 83 83))(end_p(""8 241 247)))))((value(DefineValue(RecFunctions((((value(Id uncurry))(position((start_p(""11 304 308))(end_p(""11 304 315)))))(((value(ForallTy(((value(TId `a))(position((start_p(""10 249 256))(end_p(""10 249 258)))))((value(TId `b))(position((start_p(""10 249 260))(end_p(""10 249 262)))))((value(TId `c))(position((start_p(""10 249 264))(end_p(""10 249 266))))))((value(TyArrow((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""10 249 269))(end_p(""10 249 271)))))((value(TyVar(TId `b)))(position((start_p(""10 249 274))(end_p(""10 249 276))))))))(position((start_p(""10 249 269))(end_p(""10 249 276)))))((value(TyVar(TId `c)))(position((start_p(""10 249 280))(end_p(""10 249 282)))))))(position((start_p(""10 249 268))(end_p(""10 249 283)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""10 249 288))(end_p(""10 249 290)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""10 249 294))(end_p(""10 249 296)))))((value(TyVar(TId `c)))(position((start_p(""10 249 300))(end_p(""10 249 302)))))))(position((start_p(""10 249 294))(end_p(""10 249 302)))))))(position((start_p(""10 249 287))(end_p(""10 249 303)))))))(position((start_p(""10 249 268))(end_p(""10 249 303)))))))(position((start_p(""10 249 255))(end_p(""10 249 303))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""11 304 318))(end_p(""11 304 319)))))))(position((start_p(""11 304 318))(end_p(""11 304 319)))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""11 304 322))(end_p(""11 304 324)))))((value(TyVar(TId `b)))(position((start_p(""11 304 327))(end_p(""11 304 329))))))))(position((start_p(""11 304 322))(end_p(""11 304 329)))))((value(TyVar(TId `c)))(position((start_p(""11 304 333))(end_p(""11 304 335)))))))(position((start_p(""11 304 322))(end_p(""11 304 335)))))))(position((start_p(""11 304 317))(end_p(""11 304 336)))))((value(Define(RecFunctions((((value(Id fu))(position((start_p(""13 364 370))(end_p(""13 364 372)))))(((value(ForallTy()((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""12 339 349))(end_p(""12 339 351)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""12 339 355))(end_p(""12 339 357)))))((value(TyVar(TId `c)))(position((start_p(""12 339 361))(end_p(""12 339 363)))))))(position((start_p(""12 339 355))(end_p(""12 339 363)))))))(position((start_p(""12 339 349))(end_p(""12 339 363)))))))(position((start_p(""12 339 349))(end_p(""12 339 363))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""13 364 374))(end_p(""13 364 375)))))))(position((start_p(""13 364 374))(end_p(""13 364 375)))))((value(TyVar(TId `a)))(position((start_p(""13 364 378))(end_p(""13 364 380)))))))(position((start_p(""13 364 373))(end_p(""13 364 381)))))((value(Define(RecFunctions((((value(Id g))(position((start_p(""15 406 413))(end_p(""15 406 414)))))(((value(ForallTy()((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""14 384 397))(end_p(""14 384 399)))))((value(TyVar(TId `c)))(position((start_p(""14 384 403))(end_p(""14 384 405)))))))(position((start_p(""14 384 397))(end_p(""14 384 405)))))))(position((start_p(""14 384 397))(end_p(""14 384 405))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""15 406 416))(end_p(""15 406 417)))))))(position((start_p(""15 406 416))(end_p(""15 406 417)))))((value(TyVar(TId `b)))(position((start_p(""15 406 420))(end_p(""15 406 422)))))))(position((start_p(""15 406 415))(end_p(""15 406 423)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""15 406 426))(end_p(""15 406 427)))))()))(position((start_p(""15 406 426))(end_p(""15 406 427)))))((value(Tuple(((value(Variable((value(Id x))(position((start_p(""15 406 429))(end_p(""15 406 430)))))()))(position((start_p(""15 406 429))(end_p(""15 406 430)))))((value(Variable((value(Id y))(position((start_p(""15 406 432))(end_p(""15 406 433)))))()))(position((start_p(""15 406 432))(end_p(""15 406 433))))))))(position((start_p(""15 406 428))(end_p(""15 406 434)))))))(position((start_p(""15 406 426))(end_p(""15 406 434)))))))))((value(Variable((value(Id g))(position((start_p(""16 436 442))(end_p(""16 436 443)))))()))(position((start_p(""16 436 442))(end_p(""16 436 443)))))))(position((start_p(""14 384 390))(end_p(""16 436 444)))))))))((value(Variable((value(Id fu))(position((start_p(""17 446 450))(end_p(""17 446 452)))))()))(position((start_p(""17 446 450))(end_p(""17 446 452)))))))(position((start_p(""12 339 343))(end_p(""17 446 452)))))))))))(position((start_p(""10 249 249))(end_p(""17 446 452)))))((value(DefineValue(RecFunctions((((value(Id id_int))(position((start_p(""20 471 474))(end_p(""20 471 480)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""19 454 460))(end_p(""19 454 463)))))((value(TyCon(TCon int)()))(position((start_p(""19 454 467))(end_p(""19 454 470)))))))(position((start_p(""19 454 460))(end_p(""19 454 470)))))))(position((start_p(""19 454 460))(end_p(""19 454 470))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""20 471 482))(end_p(""20 471 483)))))))(position((start_p(""20 471 482))(end_p(""20 471 483)))))((value(TyCon(TCon int)()))(position((start_p(""20 471 486))(end_p(""20 471 489)))))))(position((start_p(""20 471 481))(end_p(""20 471 490)))))((value(Variable((value(Id x))(position((start_p(""20 471 493))(end_p(""20 471 494)))))()))(position((start_p(""20 471 493))(end_p(""20 471 494)))))))))))(position((start_p(""19 454 454))(end_p(""20 471 494)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""22 496 500))(end_p(""22 496 504)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""22 496 507))(end_p(""22 496 510)))))))(position((start_p(""22 496 507))(end_p(""22 496 510))))))((value(Apply((value(Apply((value(Variable((value(Id curry))(position((start_p(""23 513 517))(end_p(""23 513 522)))))((((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""23 513 523))(end_p(""23 513 526)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 530))(end_p(""23 513 533)))))))(position((start_p(""23 513 523))(end_p(""23 513 533)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 535))(end_p(""23 513 538)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 540))(end_p(""23 513 543)))))))))(position((start_p(""23 513 517))(end_p(""23 513 544)))))((value(Apply((value(Variable((value(Id uncurry))(position((start_p(""23 513 546))(end_p(""23 513 553)))))((((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""23 513 554))(end_p(""23 513 557)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 561))(end_p(""23 513 564)))))))(position((start_p(""23 513 554))(end_p(""23 513 564)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 566))(end_p(""23 513 569)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 571))(end_p(""23 513 574)))))))))(position((start_p(""23 513 546))(end_p(""23 513 575)))))((value(Variable((value(Id apply))(position((start_p(""23 513 577))(end_p(""23 513 582)))))((((value(TyCon(TCon int)()))(position((start_p(""23 513 583))(end_p(""23 513 586)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 588))(end_p(""23 513 591)))))))))(position((start_p(""23 513 576))(end_p(""23 513 593)))))))(position((start_p(""23 513 545))(end_p(""23 513 594)))))))(position((start_p(""23 513 516))(end_p(""23 513 595)))))((value(Tuple(((value(Variable((value(Id id_int))(position((start_p(""23 513 597))(end_p(""23 513 603)))))()))(position((start_p(""23 513 597))(end_p(""23 513 603)))))((value(Literal((value(LInt 37))(position((start_p(""23 513 605))(end_p(""23 513 607)))))))(position((start_p(""23 513 605))(end_p(""23 513 607))))))))(position((start_p(""23 513 596))(end_p(""23 513 608)))))))(position((start_p(""23 513 516))(end_p(""23 513 608)))))))))(position((start_p(""22 496 496))(end_p(""23 513 608)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..1bc45ea --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.bad.typing.hopix.human-readable @@ -0,0 +1,23 @@ +fun : [`a, `b] (`a -> `b) * `a -> `b + apply ((f : `a -> `b), (x : `a)) = f (x) + +fun : [`a, `b, `c] (`a -> `b -> `c) -> (`a * `b -> `c) + curry (f : `a -> `b -> `c) = + fun : `a * `b -> `c + fc ((x :`a), (y : `b)) = (f (x)) (y); + fc + +fun : [`a, `b, `c] (`a * `b -> `c) -> (`b -> `a -> `c) + uncurry (f : `a * `b -> `c) = + fun : `a -> `b -> `c + fu (x : `a) = + (fun : `b -> `c + g (y : `b) = f (x, y); + g); + fu + +fun : int -> int + id_int (x : int) = x + +let main : int = + (curry int, int, int> (uncurry int, int, int> (apply))) (id_int, 37) \ No newline at end of file diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.good.expected b/flap/tests/03-Typing/20-polymorphic-binary-function.good.expected new file mode 100644 index 0000000..3426967 --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.good.expected @@ -0,0 +1,5 @@ +apply : [`a, `b] (`a -> `b) * `a -> `b +curry : [`a, `b, `c] (`a -> (`b -> `c)) -> (`a * `b -> `c) +uncurry : [`a, `b, `c] (`a * `b -> `c) -> (`a -> (`b -> `c)) +id_int : int -> int +main : int diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix b/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix new file mode 100644 index 0000000..08deea6 --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id apply))(position((start_p(""2 37 41))(end_p(""2 37 46)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyTuple(((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 16))(end_p(""1 0 18)))))((value(TyVar(TId `b)))(position((start_p(""1 0 22))(end_p(""1 0 24)))))))(position((start_p(""1 0 15))(end_p(""1 0 25)))))((value(TyVar(TId `a)))(position((start_p(""1 0 28))(end_p(""1 0 30))))))))(position((start_p(""1 0 15))(end_p(""1 0 30)))))((value(TyVar(TId `b)))(position((start_p(""1 0 34))(end_p(""1 0 36)))))))(position((start_p(""1 0 15))(end_p(""1 0 36)))))))(position((start_p(""1 0 6))(end_p(""1 0 36))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 37 49))(end_p(""2 37 50)))))))(position((start_p(""2 37 49))(end_p(""2 37 50)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 37 53))(end_p(""2 37 55)))))((value(TyVar(TId `b)))(position((start_p(""2 37 59))(end_p(""2 37 61)))))))(position((start_p(""2 37 53))(end_p(""2 37 61)))))))(position((start_p(""2 37 48))(end_p(""2 37 62)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""2 37 65))(end_p(""2 37 66)))))))(position((start_p(""2 37 65))(end_p(""2 37 66)))))((value(TyVar(TId `a)))(position((start_p(""2 37 69))(end_p(""2 37 71)))))))(position((start_p(""2 37 64))(end_p(""2 37 72))))))))(position((start_p(""2 37 47))(end_p(""2 37 73)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""2 37 76))(end_p(""2 37 77)))))()))(position((start_p(""2 37 76))(end_p(""2 37 77)))))((value(Variable((value(Id x))(position((start_p(""2 37 79))(end_p(""2 37 80)))))()))(position((start_p(""2 37 78))(end_p(""2 37 81)))))))(position((start_p(""2 37 76))(end_p(""2 37 81)))))))))))(position((start_p(""1 0 0))(end_p(""2 37 81)))))((value(DefineValue(RecFunctions((((value(Id curry))(position((start_p(""5 138 142))(end_p(""5 138 147)))))(((value(ForallTy(((value(TId `a))(position((start_p(""4 83 90))(end_p(""4 83 92)))))((value(TId `b))(position((start_p(""4 83 94))(end_p(""4 83 96)))))((value(TId `c))(position((start_p(""4 83 98))(end_p(""4 83 100))))))((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""4 83 103))(end_p(""4 83 105)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 83 109))(end_p(""4 83 111)))))((value(TyVar(TId `c)))(position((start_p(""4 83 115))(end_p(""4 83 117)))))))(position((start_p(""4 83 109))(end_p(""4 83 117)))))))(position((start_p(""4 83 102))(end_p(""4 83 118)))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""4 83 123))(end_p(""4 83 125)))))((value(TyVar(TId `b)))(position((start_p(""4 83 128))(end_p(""4 83 130))))))))(position((start_p(""4 83 123))(end_p(""4 83 130)))))((value(TyVar(TId `c)))(position((start_p(""4 83 134))(end_p(""4 83 136)))))))(position((start_p(""4 83 122))(end_p(""4 83 137)))))))(position((start_p(""4 83 102))(end_p(""4 83 137)))))))(position((start_p(""4 83 89))(end_p(""4 83 137))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""5 138 149))(end_p(""5 138 150)))))))(position((start_p(""5 138 149))(end_p(""5 138 150)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""5 138 153))(end_p(""5 138 155)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""5 138 159))(end_p(""5 138 161)))))((value(TyVar(TId `c)))(position((start_p(""5 138 165))(end_p(""5 138 167)))))))(position((start_p(""5 138 159))(end_p(""5 138 167)))))))(position((start_p(""5 138 153))(end_p(""5 138 167)))))))(position((start_p(""5 138 148))(end_p(""5 138 168)))))((value(Define(RecFunctions((((value(Id fc))(position((start_p(""7 195 203))(end_p(""7 195 205)))))(((value(ForallTy()((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""6 171 181))(end_p(""6 171 183)))))((value(TyVar(TId `b)))(position((start_p(""6 171 186))(end_p(""6 171 188))))))))(position((start_p(""6 171 181))(end_p(""6 171 188)))))((value(TyVar(TId `c)))(position((start_p(""6 171 192))(end_p(""6 171 194)))))))(position((start_p(""6 171 181))(end_p(""6 171 194)))))))(position((start_p(""6 171 181))(end_p(""6 171 194))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""7 195 208))(end_p(""7 195 209)))))))(position((start_p(""7 195 208))(end_p(""7 195 209)))))((value(TyVar(TId `a)))(position((start_p(""7 195 211))(end_p(""7 195 213)))))))(position((start_p(""7 195 207))(end_p(""7 195 214)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""7 195 217))(end_p(""7 195 218)))))))(position((start_p(""7 195 217))(end_p(""7 195 218)))))((value(TyVar(TId `b)))(position((start_p(""7 195 221))(end_p(""7 195 223)))))))(position((start_p(""7 195 216))(end_p(""7 195 224))))))))(position((start_p(""7 195 206))(end_p(""7 195 225)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""7 195 229))(end_p(""7 195 230)))))()))(position((start_p(""7 195 229))(end_p(""7 195 230)))))((value(Variable((value(Id x))(position((start_p(""7 195 232))(end_p(""7 195 233)))))()))(position((start_p(""7 195 231))(end_p(""7 195 234)))))))(position((start_p(""7 195 228))(end_p(""7 195 235)))))((value(Variable((value(Id y))(position((start_p(""7 195 237))(end_p(""7 195 238)))))()))(position((start_p(""7 195 236))(end_p(""7 195 239)))))))(position((start_p(""7 195 228))(end_p(""7 195 239)))))))))((value(Variable((value(Id fc))(position((start_p(""8 241 245))(end_p(""8 241 247)))))()))(position((start_p(""8 241 245))(end_p(""8 241 247)))))))(position((start_p(""6 171 175))(end_p(""8 241 247)))))))))))(position((start_p(""4 83 83))(end_p(""8 241 247)))))((value(DefineValue(RecFunctions((((value(Id uncurry))(position((start_p(""11 304 308))(end_p(""11 304 315)))))(((value(ForallTy(((value(TId `a))(position((start_p(""10 249 256))(end_p(""10 249 258)))))((value(TId `b))(position((start_p(""10 249 260))(end_p(""10 249 262)))))((value(TId `c))(position((start_p(""10 249 264))(end_p(""10 249 266))))))((value(TyArrow((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""10 249 269))(end_p(""10 249 271)))))((value(TyVar(TId `b)))(position((start_p(""10 249 274))(end_p(""10 249 276))))))))(position((start_p(""10 249 269))(end_p(""10 249 276)))))((value(TyVar(TId `c)))(position((start_p(""10 249 280))(end_p(""10 249 282)))))))(position((start_p(""10 249 268))(end_p(""10 249 283)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""10 249 288))(end_p(""10 249 290)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""10 249 294))(end_p(""10 249 296)))))((value(TyVar(TId `c)))(position((start_p(""10 249 300))(end_p(""10 249 302)))))))(position((start_p(""10 249 294))(end_p(""10 249 302)))))))(position((start_p(""10 249 287))(end_p(""10 249 303)))))))(position((start_p(""10 249 268))(end_p(""10 249 303)))))))(position((start_p(""10 249 255))(end_p(""10 249 303))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""11 304 318))(end_p(""11 304 319)))))))(position((start_p(""11 304 318))(end_p(""11 304 319)))))((value(TyArrow((value(TyTuple(((value(TyVar(TId `a)))(position((start_p(""11 304 322))(end_p(""11 304 324)))))((value(TyVar(TId `b)))(position((start_p(""11 304 327))(end_p(""11 304 329))))))))(position((start_p(""11 304 322))(end_p(""11 304 329)))))((value(TyVar(TId `c)))(position((start_p(""11 304 333))(end_p(""11 304 335)))))))(position((start_p(""11 304 322))(end_p(""11 304 335)))))))(position((start_p(""11 304 317))(end_p(""11 304 336)))))((value(Define(RecFunctions((((value(Id fu))(position((start_p(""13 364 370))(end_p(""13 364 372)))))(((value(ForallTy()((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""12 339 349))(end_p(""12 339 351)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""12 339 355))(end_p(""12 339 357)))))((value(TyVar(TId `c)))(position((start_p(""12 339 361))(end_p(""12 339 363)))))))(position((start_p(""12 339 355))(end_p(""12 339 363)))))))(position((start_p(""12 339 349))(end_p(""12 339 363)))))))(position((start_p(""12 339 349))(end_p(""12 339 363))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""13 364 374))(end_p(""13 364 375)))))))(position((start_p(""13 364 374))(end_p(""13 364 375)))))((value(TyVar(TId `a)))(position((start_p(""13 364 378))(end_p(""13 364 380)))))))(position((start_p(""13 364 373))(end_p(""13 364 381)))))((value(Define(RecFunctions((((value(Id g))(position((start_p(""15 406 413))(end_p(""15 406 414)))))(((value(ForallTy()((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""14 384 397))(end_p(""14 384 399)))))((value(TyVar(TId `c)))(position((start_p(""14 384 403))(end_p(""14 384 405)))))))(position((start_p(""14 384 397))(end_p(""14 384 405)))))))(position((start_p(""14 384 397))(end_p(""14 384 405))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""15 406 416))(end_p(""15 406 417)))))))(position((start_p(""15 406 416))(end_p(""15 406 417)))))((value(TyVar(TId `b)))(position((start_p(""15 406 420))(end_p(""15 406 422)))))))(position((start_p(""15 406 415))(end_p(""15 406 423)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""15 406 426))(end_p(""15 406 427)))))()))(position((start_p(""15 406 426))(end_p(""15 406 427)))))((value(Tuple(((value(Variable((value(Id x))(position((start_p(""15 406 429))(end_p(""15 406 430)))))()))(position((start_p(""15 406 429))(end_p(""15 406 430)))))((value(Variable((value(Id y))(position((start_p(""15 406 432))(end_p(""15 406 433)))))()))(position((start_p(""15 406 432))(end_p(""15 406 433))))))))(position((start_p(""15 406 428))(end_p(""15 406 434)))))))(position((start_p(""15 406 426))(end_p(""15 406 434)))))))))((value(Variable((value(Id g))(position((start_p(""16 436 442))(end_p(""16 436 443)))))()))(position((start_p(""16 436 442))(end_p(""16 436 443)))))))(position((start_p(""14 384 390))(end_p(""16 436 444)))))))))((value(Variable((value(Id fu))(position((start_p(""17 446 450))(end_p(""17 446 452)))))()))(position((start_p(""17 446 450))(end_p(""17 446 452)))))))(position((start_p(""12 339 343))(end_p(""17 446 452)))))))))))(position((start_p(""10 249 249))(end_p(""17 446 452)))))((value(DefineValue(RecFunctions((((value(Id id_int))(position((start_p(""20 471 474))(end_p(""20 471 480)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""19 454 460))(end_p(""19 454 463)))))((value(TyCon(TCon int)()))(position((start_p(""19 454 467))(end_p(""19 454 470)))))))(position((start_p(""19 454 460))(end_p(""19 454 470)))))))(position((start_p(""19 454 460))(end_p(""19 454 470))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""20 471 482))(end_p(""20 471 483)))))))(position((start_p(""20 471 482))(end_p(""20 471 483)))))((value(TyCon(TCon int)()))(position((start_p(""20 471 486))(end_p(""20 471 489)))))))(position((start_p(""20 471 481))(end_p(""20 471 490)))))((value(Variable((value(Id x))(position((start_p(""20 471 493))(end_p(""20 471 494)))))()))(position((start_p(""20 471 493))(end_p(""20 471 494)))))))))))(position((start_p(""19 454 454))(end_p(""20 471 494)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""22 496 500))(end_p(""22 496 504)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""22 496 507))(end_p(""22 496 510)))))))(position((start_p(""22 496 507))(end_p(""22 496 510))))))((value(Apply((value(Apply((value(Variable((value(Id curry))(position((start_p(""23 513 517))(end_p(""23 513 522)))))((((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""23 513 523))(end_p(""23 513 526)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 530))(end_p(""23 513 533)))))))(position((start_p(""23 513 523))(end_p(""23 513 533)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 535))(end_p(""23 513 538)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 540))(end_p(""23 513 543)))))))))(position((start_p(""23 513 517))(end_p(""23 513 544)))))((value(Apply((value(Variable((value(Id uncurry))(position((start_p(""23 513 546))(end_p(""23 513 553)))))((((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""23 513 554))(end_p(""23 513 557)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 561))(end_p(""23 513 564)))))))(position((start_p(""23 513 554))(end_p(""23 513 564)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 566))(end_p(""23 513 569)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 571))(end_p(""23 513 574)))))))))(position((start_p(""23 513 546))(end_p(""23 513 575)))))((value(Variable((value(Id apply))(position((start_p(""23 513 577))(end_p(""23 513 582)))))((((value(TyCon(TCon int)()))(position((start_p(""23 513 583))(end_p(""23 513 586)))))((value(TyCon(TCon int)()))(position((start_p(""23 513 588))(end_p(""23 513 591)))))))))(position((start_p(""23 513 576))(end_p(""23 513 593)))))))(position((start_p(""23 513 545))(end_p(""23 513 594)))))))(position((start_p(""23 513 516))(end_p(""23 513 595)))))((value(Tuple(((value(Variable((value(Id id_int))(position((start_p(""23 513 597))(end_p(""23 513 603)))))()))(position((start_p(""23 513 597))(end_p(""23 513 603)))))((value(Literal((value(LInt 37))(position((start_p(""23 513 605))(end_p(""23 513 607)))))))(position((start_p(""23 513 605))(end_p(""23 513 607))))))))(position((start_p(""23 513 596))(end_p(""23 513 608)))))))(position((start_p(""23 513 516))(end_p(""23 513 608)))))))))(position((start_p(""22 496 496))(end_p(""23 513 608)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..6991664 --- /dev/null +++ b/flap/tests/03-Typing/20-polymorphic-binary-function.good.typing.hopix.human-readable @@ -0,0 +1,23 @@ +fun : [`a, `b] (`a -> `b) * `a -> `b + apply ((f : `a -> `b), (x : `a)) = f (x) + +fun : [`a, `b, `c] (`a -> `b -> `c) -> (`a * `b -> `c) + curry (f : `a -> `b -> `c) = + fun : `a * `b -> `c + fc ((x :`a), (y : `b)) = (f (x)) (y); + fc + +fun : [`a, `b, `c] (`a * `b -> `c) -> (`a -> `b -> `c) + uncurry (f : `a * `b -> `c) = + fun : `a -> `b -> `c + fu (x : `a) = + (fun : `b -> `c + g (y : `b) = f (x, y); + g); + fu + +fun : int -> int + id_int (x : int) = x + +let main : int = + (curry int, int, int> (uncurry int, int, int> (apply))) (id_int, 37) \ No newline at end of file diff --git a/flap/tests/03-Typing/21-record-01.bad.expected b/flap/tests/03-Typing/21-record-01.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/21-record-01.bad.typing.hopix b/flap/tests/03-Typing/21-record-01.bad.typing.hopix new file mode 100644 index 0000000..516b8e4 --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineRecordType((((value(LId x))(position((start_p(""1 0 11))(end_p(""1 0 12)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 15))(end_p(""1 0 18))))))(((value(LId y))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 24))(end_p(""1 0 27))))))))))(position((start_p(""1 0 0))(end_p(""1 0 29)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 31 35))(end_p(""3 31 36)))))(((value(ForallTy()((value(TyCon(TCon p)()))(position((start_p(""3 31 39))(end_p(""3 31 40)))))))(position((start_p(""3 31 39))(end_p(""3 31 40))))))((value(Record((((value(LId x))(position((start_p(""3 31 45))(end_p(""3 31 46)))))((value(Literal((value(LInt 0))(position((start_p(""3 31 49))(end_p(""3 31 50)))))))(position((start_p(""3 31 49))(end_p(""3 31 50))))))(((value(LId y))(position((start_p(""3 31 52))(end_p(""3 31 53)))))((value(Literal((value(LString foo))(position((start_p(""3 31 60))(end_p(""3 31 61)))))))(position((start_p(""3 31 60))(end_p(""3 31 61)))))))(())))(position((start_p(""3 31 43))(end_p(""3 31 65)))))))))(position((start_p(""3 31 31))(end_p(""3 31 65)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/21-record-01.bad.typing.hopix.human-readable b/flap/tests/03-Typing/21-record-01.bad.typing.hopix.human-readable new file mode 100644 index 0000000..85b7a1e --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p = { x : int, y : int } + +let x : p = { x = 0, y = "foo" }<> \ No newline at end of file diff --git a/flap/tests/03-Typing/21-record-01.good.expected b/flap/tests/03-Typing/21-record-01.good.expected new file mode 100644 index 0000000..62652c8 --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.good.expected @@ -0,0 +1 @@ +x : p diff --git a/flap/tests/03-Typing/21-record-01.good.typing.hopix b/flap/tests/03-Typing/21-record-01.good.typing.hopix new file mode 100644 index 0000000..f4efce6 --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineRecordType((((value(LId x))(position((start_p(""1 0 11))(end_p(""1 0 12)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 15))(end_p(""1 0 18))))))(((value(LId y))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 24))(end_p(""1 0 27))))))))))(position((start_p(""1 0 0))(end_p(""1 0 29)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 31 35))(end_p(""3 31 36)))))(((value(ForallTy()((value(TyCon(TCon p)()))(position((start_p(""3 31 39))(end_p(""3 31 40)))))))(position((start_p(""3 31 39))(end_p(""3 31 40))))))((value(Record((((value(LId x))(position((start_p(""3 31 45))(end_p(""3 31 46)))))((value(Literal((value(LInt 0))(position((start_p(""3 31 49))(end_p(""3 31 50)))))))(position((start_p(""3 31 49))(end_p(""3 31 50))))))(((value(LId y))(position((start_p(""3 31 52))(end_p(""3 31 53)))))((value(Literal((value(LInt 1))(position((start_p(""3 31 56))(end_p(""3 31 57)))))))(position((start_p(""3 31 56))(end_p(""3 31 57)))))))(())))(position((start_p(""3 31 43))(end_p(""3 31 61)))))))))(position((start_p(""3 31 31))(end_p(""3 31 61)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/21-record-01.good.typing.hopix.human-readable b/flap/tests/03-Typing/21-record-01.good.typing.hopix.human-readable new file mode 100644 index 0000000..d1d0f8c --- /dev/null +++ b/flap/tests/03-Typing/21-record-01.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p = { x : int, y : int } + +let x : p = { x = 0, y = 1 }<> \ No newline at end of file diff --git a/flap/tests/03-Typing/22-polymorphic-record.bad.expected b/flap/tests/03-Typing/22-polymorphic-record.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix b/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix new file mode 100644 index 0000000..80ff508 --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(TyVar(TId `a)))(position((start_p(""1 0 20))(end_p(""1 0 22))))))(((value(LId y))(position((start_p(""1 0 24))(end_p(""1 0 25)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 28))(end_p(""1 0 34))))))))))(position((start_p(""1 0 0))(end_p(""1 0 36)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 38 42))(end_p(""3 38 43)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 38 49))(end_p(""3 38 52))))))))(position((start_p(""3 38 46))(end_p(""3 38 53)))))))(position((start_p(""3 38 46))(end_p(""3 38 53))))))((value(Record((((value(LId x))(position((start_p(""3 38 58))(end_p(""3 38 59)))))((value(Literal((value(LInt 0))(position((start_p(""3 38 62))(end_p(""3 38 63)))))))(position((start_p(""3 38 62))(end_p(""3 38 63))))))(((value(LId y))(position((start_p(""3 38 65))(end_p(""3 38 66)))))((value(Literal((value(LInt 1))(position((start_p(""3 38 69))(end_p(""3 38 70)))))))(position((start_p(""3 38 69))(end_p(""3 38 70)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 38 73))(end_p(""3 38 76)))))))))(position((start_p(""3 38 56))(end_p(""3 38 77)))))))))(position((start_p(""3 38 38))(end_p(""3 38 77)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix.human-readable b/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix.human-readable new file mode 100644 index 0000000..31c8e2a --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p <`a> = { x : `a, y : string } + +let x : p = { x = 0, y = 1 } \ No newline at end of file diff --git a/flap/tests/03-Typing/22-polymorphic-record.good.expected b/flap/tests/03-Typing/22-polymorphic-record.good.expected new file mode 100644 index 0000000..948db15 --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.good.expected @@ -0,0 +1 @@ +x : p diff --git a/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix b/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix new file mode 100644 index 0000000..7419b03 --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(TyVar(TId `a)))(position((start_p(""1 0 20))(end_p(""1 0 22))))))(((value(LId y))(position((start_p(""1 0 24))(end_p(""1 0 25)))))((value(TyVar(TId `a)))(position((start_p(""1 0 28))(end_p(""1 0 30))))))))))(position((start_p(""1 0 0))(end_p(""1 0 32)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 34 38))(end_p(""3 34 39)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 34 45))(end_p(""3 34 48))))))))(position((start_p(""3 34 42))(end_p(""3 34 49)))))))(position((start_p(""3 34 42))(end_p(""3 34 49))))))((value(Record((((value(LId x))(position((start_p(""3 34 54))(end_p(""3 34 55)))))((value(Literal((value(LInt 0))(position((start_p(""3 34 58))(end_p(""3 34 59)))))))(position((start_p(""3 34 58))(end_p(""3 34 59))))))(((value(LId y))(position((start_p(""3 34 61))(end_p(""3 34 62)))))((value(Literal((value(LInt 1))(position((start_p(""3 34 65))(end_p(""3 34 66)))))))(position((start_p(""3 34 65))(end_p(""3 34 66)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 34 69))(end_p(""3 34 72)))))))))(position((start_p(""3 34 52))(end_p(""3 34 73)))))))))(position((start_p(""3 34 34))(end_p(""3 34 73)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix.human-readable b/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix.human-readable new file mode 100644 index 0000000..7bd33ed --- /dev/null +++ b/flap/tests/03-Typing/22-polymorphic-record.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p <`a> = { x : `a, y : `a } + +let x : p = { x = 0, y = 1 } \ No newline at end of file diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.bad.expected b/flap/tests/03-Typing/23-polymorphic-record-02.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix b/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix new file mode 100644 index 0000000..d488688 --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10)))))((value(TId `b))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 24))(end_p(""1 0 30))))))(((value(LId y))(position((start_p(""1 0 32))(end_p(""1 0 33)))))((value(TyVar(TId `b)))(position((start_p(""1 0 36))(end_p(""1 0 38))))))))))(position((start_p(""1 0 0))(end_p(""1 0 40)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 42 46))(end_p(""3 42 47)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 42 53))(end_p(""3 42 56)))))((value(TyCon(TCon string)()))(position((start_p(""3 42 58))(end_p(""3 42 64))))))))(position((start_p(""3 42 50))(end_p(""3 42 65)))))))(position((start_p(""3 42 50))(end_p(""3 42 65))))))((value(Record((((value(LId x))(position((start_p(""3 42 70))(end_p(""3 42 71)))))((value(Literal((value(LInt 0))(position((start_p(""3 42 74))(end_p(""3 42 75)))))))(position((start_p(""3 42 74))(end_p(""3 42 75))))))(((value(LId y))(position((start_p(""3 42 77))(end_p(""3 42 78)))))((value(Literal((value(LString"River Song"))(position((start_p(""3 42 92))(end_p(""3 42 93)))))))(position((start_p(""3 42 92))(end_p(""3 42 93)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 42 96))(end_p(""3 42 99)))))((value(TyCon(TCon string)()))(position((start_p(""3 42 101))(end_p(""3 42 107)))))))))(position((start_p(""3 42 68))(end_p(""3 42 108)))))))))(position((start_p(""3 42 42))(end_p(""3 42 108)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix.human-readable b/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix.human-readable new file mode 100644 index 0000000..6328d4f --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p <`a, `b> = { x : string, y : `b } + +let x : p = { x = 0, y = "River Song" } \ No newline at end of file diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.good.expected b/flap/tests/03-Typing/23-polymorphic-record-02.good.expected new file mode 100644 index 0000000..1ca64d4 --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.good.expected @@ -0,0 +1 @@ +x : p diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix b/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix new file mode 100644 index 0000000..d360cb3 --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10)))))((value(TId `b))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyVar(TId `a)))(position((start_p(""1 0 24))(end_p(""1 0 26))))))(((value(LId y))(position((start_p(""1 0 28))(end_p(""1 0 29)))))((value(TyVar(TId `b)))(position((start_p(""1 0 32))(end_p(""1 0 34))))))))))(position((start_p(""1 0 0))(end_p(""1 0 36)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 38 42))(end_p(""3 38 43)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 38 49))(end_p(""3 38 52)))))((value(TyCon(TCon string)()))(position((start_p(""3 38 54))(end_p(""3 38 60))))))))(position((start_p(""3 38 46))(end_p(""3 38 61)))))))(position((start_p(""3 38 46))(end_p(""3 38 61))))))((value(Record((((value(LId x))(position((start_p(""3 38 66))(end_p(""3 38 67)))))((value(Literal((value(LInt 0))(position((start_p(""3 38 70))(end_p(""3 38 71)))))))(position((start_p(""3 38 70))(end_p(""3 38 71))))))(((value(LId y))(position((start_p(""3 38 73))(end_p(""3 38 74)))))((value(Literal((value(LString"River Song"))(position((start_p(""3 38 88))(end_p(""3 38 89)))))))(position((start_p(""3 38 88))(end_p(""3 38 89)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 38 92))(end_p(""3 38 95)))))((value(TyCon(TCon string)()))(position((start_p(""3 38 97))(end_p(""3 38 103)))))))))(position((start_p(""3 38 64))(end_p(""3 38 104)))))))))(position((start_p(""3 38 38))(end_p(""3 38 104)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix.human-readable b/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix.human-readable new file mode 100644 index 0000000..e819189 --- /dev/null +++ b/flap/tests/03-Typing/23-polymorphic-record-02.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type p <`a, `b> = { x : `a, y : `b } + +let x : p = { x = 0, y = "River Song" } \ No newline at end of file diff --git a/flap/tests/03-Typing/24-record-proj.bad.expected b/flap/tests/03-Typing/24-record-proj.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/24-record-proj.bad.typing.hopix b/flap/tests/03-Typing/24-record-proj.bad.typing.hopix new file mode 100644 index 0000000..5df6b22 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineRecordType((((value(LId x))(position((start_p(""1 0 11))(end_p(""1 0 12)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 15))(end_p(""1 0 18))))))(((value(LId y))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 24))(end_p(""1 0 30))))))))))(position((start_p(""1 0 0))(end_p(""1 0 32)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""3 34 38))(end_p(""3 34 39)))))(((value(ForallTy()((value(TyCon(TCon p)()))(position((start_p(""3 34 42))(end_p(""3 34 43)))))))(position((start_p(""3 34 42))(end_p(""3 34 43))))))((value(Record((((value(LId x))(position((start_p(""3 34 48))(end_p(""3 34 49)))))((value(Literal((value(LInt 42))(position((start_p(""3 34 52))(end_p(""3 34 54)))))))(position((start_p(""3 34 52))(end_p(""3 34 54))))))(((value(LId y))(position((start_p(""3 34 56))(end_p(""3 34 57)))))((value(Literal((value(LString Dalek))(position((start_p(""3 34 66))(end_p(""3 34 67)))))))(position((start_p(""3 34 66))(end_p(""3 34 67)))))))(())))(position((start_p(""3 34 46))(end_p(""3 34 71)))))))))(position((start_p(""3 34 34))(end_p(""3 34 71)))))((value(DefineValue(SimpleValue(((value(Id px))(position((start_p(""5 73 77))(end_p(""5 73 79)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""5 73 82))(end_p(""5 73 88)))))))(position((start_p(""5 73 82))(end_p(""5 73 88))))))((value(Field((value(Variable((value(Id p))(position((start_p(""5 73 91))(end_p(""5 73 92)))))()))(position((start_p(""5 73 91))(end_p(""5 73 92)))))((value(LId x))(position((start_p(""5 73 93))(end_p(""5 73 94)))))()))(position((start_p(""5 73 91))(end_p(""5 73 94)))))))))(position((start_p(""5 73 73))(end_p(""5 73 94)))))((value(DefineValue(SimpleValue(((value(Id py))(position((start_p(""7 96 100))(end_p(""7 96 102)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 96 105))(end_p(""7 96 111)))))))(position((start_p(""7 96 105))(end_p(""7 96 111))))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 96 114))(end_p(""7 96 115)))))()))(position((start_p(""7 96 114))(end_p(""7 96 115)))))((value(LId y))(position((start_p(""7 96 116))(end_p(""7 96 117)))))()))(position((start_p(""7 96 114))(end_p(""7 96 117)))))))))(position((start_p(""7 96 96))(end_p(""7 96 117)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/24-record-proj.bad.typing.hopix.human-readable b/flap/tests/03-Typing/24-record-proj.bad.typing.hopix.human-readable new file mode 100644 index 0000000..88a7be4 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +type p = { x : int, y : string } + +let p : p = { x = 42, y = "Dalek" }<> + +let px : string = p.x + +let py : string = p.y \ No newline at end of file diff --git a/flap/tests/03-Typing/24-record-proj.good.expected b/flap/tests/03-Typing/24-record-proj.good.expected new file mode 100644 index 0000000..799aba2 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.good.expected @@ -0,0 +1,3 @@ +p : p +px : int +py : string diff --git a/flap/tests/03-Typing/24-record-proj.good.typing.hopix b/flap/tests/03-Typing/24-record-proj.good.typing.hopix new file mode 100644 index 0000000..c9c26c3 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineRecordType((((value(LId x))(position((start_p(""1 0 11))(end_p(""1 0 12)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 15))(end_p(""1 0 18))))))(((value(LId y))(position((start_p(""1 0 20))(end_p(""1 0 21)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 24))(end_p(""1 0 30))))))))))(position((start_p(""1 0 0))(end_p(""1 0 32)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""3 34 38))(end_p(""3 34 39)))))(((value(ForallTy()((value(TyCon(TCon p)()))(position((start_p(""3 34 42))(end_p(""3 34 43)))))))(position((start_p(""3 34 42))(end_p(""3 34 43))))))((value(Record((((value(LId x))(position((start_p(""3 34 48))(end_p(""3 34 49)))))((value(Literal((value(LInt 42))(position((start_p(""3 34 52))(end_p(""3 34 54)))))))(position((start_p(""3 34 52))(end_p(""3 34 54))))))(((value(LId y))(position((start_p(""3 34 56))(end_p(""3 34 57)))))((value(Literal((value(LString Dalek))(position((start_p(""3 34 66))(end_p(""3 34 67)))))))(position((start_p(""3 34 66))(end_p(""3 34 67)))))))(())))(position((start_p(""3 34 46))(end_p(""3 34 71)))))))))(position((start_p(""3 34 34))(end_p(""3 34 71)))))((value(DefineValue(SimpleValue(((value(Id px))(position((start_p(""5 73 77))(end_p(""5 73 79)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""5 73 82))(end_p(""5 73 85)))))))(position((start_p(""5 73 82))(end_p(""5 73 85))))))((value(Field((value(Variable((value(Id p))(position((start_p(""5 73 88))(end_p(""5 73 89)))))()))(position((start_p(""5 73 88))(end_p(""5 73 89)))))((value(LId x))(position((start_p(""5 73 90))(end_p(""5 73 91)))))()))(position((start_p(""5 73 88))(end_p(""5 73 91)))))))))(position((start_p(""5 73 73))(end_p(""5 73 91)))))((value(DefineValue(SimpleValue(((value(Id py))(position((start_p(""7 93 97))(end_p(""7 93 99)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 93 102))(end_p(""7 93 108)))))))(position((start_p(""7 93 102))(end_p(""7 93 108))))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 93 111))(end_p(""7 93 112)))))()))(position((start_p(""7 93 111))(end_p(""7 93 112)))))((value(LId y))(position((start_p(""7 93 113))(end_p(""7 93 114)))))()))(position((start_p(""7 93 111))(end_p(""7 93 114)))))))))(position((start_p(""7 93 93))(end_p(""7 93 114)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/24-record-proj.good.typing.hopix.human-readable b/flap/tests/03-Typing/24-record-proj.good.typing.hopix.human-readable new file mode 100644 index 0000000..4432db6 --- /dev/null +++ b/flap/tests/03-Typing/24-record-proj.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +type p = { x : int, y : string } + +let p : p = { x = 42, y = "Dalek" }<> + +let px : int = p.x + +let py : string = p.y \ No newline at end of file diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.bad.expected b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.expected new file mode 100644 index 0000000..1c2bdde --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Unbound label `z'. diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix new file mode 100644 index 0000000..4324934 --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25))))))(((value(LId y))(position((start_p(""1 0 27))(end_p(""1 0 28)))))((value(TyVar(TId `b)))(position((start_p(""1 0 31))(end_p(""1 0 33))))))))))(position((start_p(""1 0 0))(end_p(""1 0 35)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""3 37 41))(end_p(""3 37 42)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 37 47))(end_p(""3 37 50)))))((value(TyCon(TCon string)()))(position((start_p(""3 37 52))(end_p(""3 37 58))))))))(position((start_p(""3 37 45))(end_p(""3 37 59)))))))(position((start_p(""3 37 45))(end_p(""3 37 59))))))((value(Record((((value(LId x))(position((start_p(""3 37 64))(end_p(""3 37 65)))))((value(Literal((value(LInt 0))(position((start_p(""3 37 68))(end_p(""3 37 69)))))))(position((start_p(""3 37 68))(end_p(""3 37 69))))))(((value(LId y))(position((start_p(""3 37 71))(end_p(""3 37 72)))))((value(Literal((value(LString"Rose Tyler"))(position((start_p(""3 37 86))(end_p(""3 37 87)))))))(position((start_p(""3 37 86))(end_p(""3 37 87)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 37 90))(end_p(""3 37 93)))))((value(TyCon(TCon string)()))(position((start_p(""3 37 95))(end_p(""3 37 101)))))))))(position((start_p(""3 37 62))(end_p(""3 37 102)))))))))(position((start_p(""3 37 37))(end_p(""3 37 102)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""5 104 108))(end_p(""5 104 109)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""5 104 112))(end_p(""5 104 115)))))))(position((start_p(""5 104 112))(end_p(""5 104 115))))))((value(Field((value(Variable((value(Id p))(position((start_p(""5 104 118))(end_p(""5 104 119)))))()))(position((start_p(""5 104 118))(end_p(""5 104 119)))))((value(LId x))(position((start_p(""5 104 120))(end_p(""5 104 121)))))((((value(TyCon(TCon int)()))(position((start_p(""5 104 122))(end_p(""5 104 125)))))((value(TyCon(TCon string)()))(position((start_p(""5 104 127))(end_p(""5 104 133)))))))))(position((start_p(""5 104 118))(end_p(""5 104 134)))))))))(position((start_p(""5 104 104))(end_p(""5 104 134)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""7 136 140))(end_p(""7 136 141)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 136 144))(end_p(""7 136 150)))))))(position((start_p(""7 136 144))(end_p(""7 136 150))))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 136 153))(end_p(""7 136 154)))))()))(position((start_p(""7 136 153))(end_p(""7 136 154)))))((value(LId z))(position((start_p(""7 136 155))(end_p(""7 136 156)))))((((value(TyCon(TCon int)()))(position((start_p(""7 136 157))(end_p(""7 136 160)))))((value(TyCon(TCon string)()))(position((start_p(""7 136 162))(end_p(""7 136 168)))))))))(position((start_p(""7 136 153))(end_p(""7 136 169)))))))))(position((start_p(""7 136 136))(end_p(""7 136 169)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix.human-readable b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix.human-readable new file mode 100644 index 0000000..41a5ebe --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +type p<`a, `b> = { x : `a, y : `b } + +let p : p = { x = 0, y = "Rose Tyler" } + +let x : int = p.x + +let y : string = p.z diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.good.expected b/flap/tests/03-Typing/25-polymorphic-record-proj.good.expected new file mode 100644 index 0000000..632a7ff --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.good.expected @@ -0,0 +1,3 @@ +p : p +x : int +y : string diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix b/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix new file mode 100644 index 0000000..a4821a7 --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25))))))(((value(LId y))(position((start_p(""1 0 27))(end_p(""1 0 28)))))((value(TyVar(TId `b)))(position((start_p(""1 0 31))(end_p(""1 0 33))))))))))(position((start_p(""1 0 0))(end_p(""1 0 35)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""3 37 41))(end_p(""3 37 42)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 37 47))(end_p(""3 37 50)))))((value(TyCon(TCon string)()))(position((start_p(""3 37 52))(end_p(""3 37 58))))))))(position((start_p(""3 37 45))(end_p(""3 37 59)))))))(position((start_p(""3 37 45))(end_p(""3 37 59))))))((value(Record((((value(LId x))(position((start_p(""3 37 64))(end_p(""3 37 65)))))((value(Literal((value(LInt 0))(position((start_p(""3 37 68))(end_p(""3 37 69)))))))(position((start_p(""3 37 68))(end_p(""3 37 69))))))(((value(LId y))(position((start_p(""3 37 71))(end_p(""3 37 72)))))((value(Literal((value(LString"Rose Tyler"))(position((start_p(""3 37 86))(end_p(""3 37 87)))))))(position((start_p(""3 37 86))(end_p(""3 37 87)))))))((((value(TyCon(TCon int)()))(position((start_p(""3 37 90))(end_p(""3 37 93)))))((value(TyCon(TCon string)()))(position((start_p(""3 37 95))(end_p(""3 37 101)))))))))(position((start_p(""3 37 62))(end_p(""3 37 102)))))))))(position((start_p(""3 37 37))(end_p(""3 37 102)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""5 104 108))(end_p(""5 104 109)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""5 104 112))(end_p(""5 104 115)))))))(position((start_p(""5 104 112))(end_p(""5 104 115))))))((value(Field((value(Variable((value(Id p))(position((start_p(""5 104 118))(end_p(""5 104 119)))))()))(position((start_p(""5 104 118))(end_p(""5 104 119)))))((value(LId x))(position((start_p(""5 104 120))(end_p(""5 104 121)))))((((value(TyCon(TCon int)()))(position((start_p(""5 104 122))(end_p(""5 104 125)))))((value(TyCon(TCon string)()))(position((start_p(""5 104 127))(end_p(""5 104 133)))))))))(position((start_p(""5 104 118))(end_p(""5 104 134)))))))))(position((start_p(""5 104 104))(end_p(""5 104 134)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""7 136 140))(end_p(""7 136 141)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""7 136 144))(end_p(""7 136 150)))))))(position((start_p(""7 136 144))(end_p(""7 136 150))))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 136 153))(end_p(""7 136 154)))))()))(position((start_p(""7 136 153))(end_p(""7 136 154)))))((value(LId y))(position((start_p(""7 136 155))(end_p(""7 136 156)))))((((value(TyCon(TCon int)()))(position((start_p(""7 136 157))(end_p(""7 136 160)))))((value(TyCon(TCon string)()))(position((start_p(""7 136 162))(end_p(""7 136 168)))))))))(position((start_p(""7 136 153))(end_p(""7 136 169)))))))))(position((start_p(""7 136 136))(end_p(""7 136 169)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix.human-readable b/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix.human-readable new file mode 100644 index 0000000..20227fa --- /dev/null +++ b/flap/tests/03-Typing/25-polymorphic-record-proj.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +type p<`a, `b> = { x : `a, y : `b } + +let p : p = { x = 0, y = "Rose Tyler" } + +let x : int = p.x + +let y : string = p.y diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.expected b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.expected new file mode 100644 index 0000000..af772b3 --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `b +Given: + `a diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix new file mode 100644 index 0000000..26f70a2 --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25))))))(((value(LId y))(position((start_p(""1 0 27))(end_p(""1 0 28)))))((value(TyVar(TId `b)))(position((start_p(""1 0 31))(end_p(""1 0 33))))))))))(position((start_p(""1 0 0))(end_p(""1 0 35)))))((value(DefineValue(RecFunctions((((value(Id get_x))(position((start_p(""4 68 72))(end_p(""4 68 77)))))(((value(ForallTy(((value(TId `a))(position((start_p(""3 37 44))(end_p(""3 37 46)))))((value(TId `b))(position((start_p(""3 37 48))(end_p(""3 37 50))))))((value(TyArrow((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""3 37 54))(end_p(""3 37 56)))))((value(TyVar(TId `b)))(position((start_p(""3 37 58))(end_p(""3 37 60))))))))(position((start_p(""3 37 52))(end_p(""3 37 61)))))((value(TyVar(TId `a)))(position((start_p(""3 37 65))(end_p(""3 37 67)))))))(position((start_p(""3 37 52))(end_p(""3 37 67)))))))(position((start_p(""3 37 43))(end_p(""3 37 67))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id p))(position((start_p(""4 68 79))(end_p(""4 68 80)))))))(position((start_p(""4 68 79))(end_p(""4 68 80)))))((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""4 68 85))(end_p(""4 68 87)))))((value(TyVar(TId `b)))(position((start_p(""4 68 89))(end_p(""4 68 91))))))))(position((start_p(""4 68 83))(end_p(""4 68 92)))))))(position((start_p(""4 68 78))(end_p(""4 68 93)))))((value(Field((value(Variable((value(Id p))(position((start_p(""4 68 96))(end_p(""4 68 97)))))()))(position((start_p(""4 68 96))(end_p(""4 68 97)))))((value(LId x))(position((start_p(""4 68 98))(end_p(""4 68 99)))))((((value(TyVar(TId `a)))(position((start_p(""4 68 100))(end_p(""4 68 102)))))((value(TyVar(TId `b)))(position((start_p(""4 68 104))(end_p(""4 68 106)))))))))(position((start_p(""4 68 96))(end_p(""4 68 107)))))))))))(position((start_p(""3 37 37))(end_p(""4 68 107)))))((value(DefineValue(RecFunctions((((value(Id get_y))(position((start_p(""7 140 143))(end_p(""7 140 148)))))(((value(ForallTy(((value(TId `a))(position((start_p(""6 109 116))(end_p(""6 109 118)))))((value(TId `b))(position((start_p(""6 109 120))(end_p(""6 109 122))))))((value(TyArrow((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""6 109 126))(end_p(""6 109 128)))))((value(TyVar(TId `b)))(position((start_p(""6 109 130))(end_p(""6 109 132))))))))(position((start_p(""6 109 124))(end_p(""6 109 133)))))((value(TyVar(TId `b)))(position((start_p(""6 109 137))(end_p(""6 109 139)))))))(position((start_p(""6 109 124))(end_p(""6 109 139)))))))(position((start_p(""6 109 115))(end_p(""6 109 139))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id p))(position((start_p(""7 140 150))(end_p(""7 140 151)))))))(position((start_p(""7 140 150))(end_p(""7 140 151)))))((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""7 140 156))(end_p(""7 140 158)))))((value(TyVar(TId `b)))(position((start_p(""7 140 160))(end_p(""7 140 162))))))))(position((start_p(""7 140 154))(end_p(""7 140 163)))))))(position((start_p(""7 140 149))(end_p(""7 140 164)))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 140 167))(end_p(""7 140 168)))))()))(position((start_p(""7 140 167))(end_p(""7 140 168)))))((value(LId x))(position((start_p(""7 140 169))(end_p(""7 140 170)))))((((value(TyVar(TId `a)))(position((start_p(""7 140 171))(end_p(""7 140 173)))))((value(TyVar(TId `b)))(position((start_p(""7 140 175))(end_p(""7 140 177)))))))))(position((start_p(""7 140 167))(end_p(""7 140 178)))))))))))(position((start_p(""6 109 109))(end_p(""7 140 178)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""9 180 184))(end_p(""9 180 185)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""9 180 190))(end_p(""9 180 193)))))((value(TyCon(TCon string)()))(position((start_p(""9 180 195))(end_p(""9 180 201))))))))(position((start_p(""9 180 188))(end_p(""9 180 202)))))))(position((start_p(""9 180 188))(end_p(""9 180 202))))))((value(Record((((value(LId x))(position((start_p(""9 180 207))(end_p(""9 180 208)))))((value(Literal((value(LInt 37))(position((start_p(""9 180 211))(end_p(""9 180 213)))))))(position((start_p(""9 180 211))(end_p(""9 180 213))))))(((value(LId y))(position((start_p(""9 180 215))(end_p(""9 180 216)))))((value(Literal((value(LString"Rory Williams"))(position((start_p(""9 180 233))(end_p(""9 180 234)))))))(position((start_p(""9 180 233))(end_p(""9 180 234)))))))((((value(TyCon(TCon int)()))(position((start_p(""9 180 237))(end_p(""9 180 240)))))((value(TyCon(TCon string)()))(position((start_p(""9 180 242))(end_p(""9 180 248)))))))))(position((start_p(""9 180 205))(end_p(""9 180 249)))))))))(position((start_p(""9 180 180))(end_p(""9 180 249)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""11 251 255))(end_p(""11 251 256)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""11 251 259))(end_p(""11 251 262)))))))(position((start_p(""11 251 259))(end_p(""11 251 262))))))((value(Apply((value(Variable((value(Id get_x))(position((start_p(""11 251 265))(end_p(""11 251 270)))))((((value(TyCon(TCon int)()))(position((start_p(""11 251 271))(end_p(""11 251 274)))))((value(TyCon(TCon string)()))(position((start_p(""11 251 276))(end_p(""11 251 282)))))))))(position((start_p(""11 251 265))(end_p(""11 251 283)))))((value(Variable((value(Id p))(position((start_p(""11 251 284))(end_p(""11 251 285)))))()))(position((start_p(""11 251 283))(end_p(""11 251 286)))))))(position((start_p(""11 251 265))(end_p(""11 251 286)))))))))(position((start_p(""11 251 251))(end_p(""11 251 286)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""13 288 292))(end_p(""13 288 293)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""13 288 296))(end_p(""13 288 302)))))))(position((start_p(""13 288 296))(end_p(""13 288 302))))))((value(Apply((value(Variable((value(Id get_y))(position((start_p(""13 288 305))(end_p(""13 288 310)))))((((value(TyCon(TCon int)()))(position((start_p(""13 288 311))(end_p(""13 288 314)))))((value(TyCon(TCon string)()))(position((start_p(""13 288 316))(end_p(""13 288 322)))))))))(position((start_p(""13 288 305))(end_p(""13 288 323)))))((value(Variable((value(Id p))(position((start_p(""13 288 324))(end_p(""13 288 325)))))()))(position((start_p(""13 288 323))(end_p(""13 288 326)))))))(position((start_p(""13 288 305))(end_p(""13 288 326)))))))))(position((start_p(""13 288 288))(end_p(""13 288 326)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix.human-readable b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix.human-readable new file mode 100644 index 0000000..9d3a89f --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.bad.typing.hopix.human-readable @@ -0,0 +1,13 @@ +type p<`a, `b> = { x : `a, y : `b } + +fun : [`a, `b] p<`a, `b> -> `a + get_x (p : p<`a, `b>) = p.x<`a, `b> + +fun : [`a, `b] p<`a, `b> -> `b + get_y (p : p<`a, `b>) = p.x<`a, `b> + +let p : p = { x = 37, y = "Rory Williams" } + +let x : int = get_x(p) + +let y : string = get_y(p) \ No newline at end of file diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.good.expected b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.expected new file mode 100644 index 0000000..a367408 --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.expected @@ -0,0 +1,5 @@ +get_x : [`a, `b] p<`a, `b> -> `a +get_y : [`a, `b] p<`a, `b> -> `b +p : p +x : int +y : string diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix new file mode 100644 index 0000000..5ce8d51 --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId x))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25))))))(((value(LId y))(position((start_p(""1 0 27))(end_p(""1 0 28)))))((value(TyVar(TId `b)))(position((start_p(""1 0 31))(end_p(""1 0 33))))))))))(position((start_p(""1 0 0))(end_p(""1 0 35)))))((value(DefineValue(RecFunctions((((value(Id get_x))(position((start_p(""4 68 72))(end_p(""4 68 77)))))(((value(ForallTy(((value(TId `a))(position((start_p(""3 37 44))(end_p(""3 37 46)))))((value(TId `b))(position((start_p(""3 37 48))(end_p(""3 37 50))))))((value(TyArrow((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""3 37 54))(end_p(""3 37 56)))))((value(TyVar(TId `b)))(position((start_p(""3 37 58))(end_p(""3 37 60))))))))(position((start_p(""3 37 52))(end_p(""3 37 61)))))((value(TyVar(TId `a)))(position((start_p(""3 37 65))(end_p(""3 37 67)))))))(position((start_p(""3 37 52))(end_p(""3 37 67)))))))(position((start_p(""3 37 43))(end_p(""3 37 67))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id p))(position((start_p(""4 68 79))(end_p(""4 68 80)))))))(position((start_p(""4 68 79))(end_p(""4 68 80)))))((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""4 68 85))(end_p(""4 68 87)))))((value(TyVar(TId `b)))(position((start_p(""4 68 89))(end_p(""4 68 91))))))))(position((start_p(""4 68 83))(end_p(""4 68 92)))))))(position((start_p(""4 68 78))(end_p(""4 68 93)))))((value(Field((value(Variable((value(Id p))(position((start_p(""4 68 96))(end_p(""4 68 97)))))()))(position((start_p(""4 68 96))(end_p(""4 68 97)))))((value(LId x))(position((start_p(""4 68 98))(end_p(""4 68 99)))))((((value(TyVar(TId `a)))(position((start_p(""4 68 100))(end_p(""4 68 102)))))((value(TyVar(TId `b)))(position((start_p(""4 68 104))(end_p(""4 68 106)))))))))(position((start_p(""4 68 96))(end_p(""4 68 107)))))))))))(position((start_p(""3 37 37))(end_p(""4 68 107)))))((value(DefineValue(RecFunctions((((value(Id get_y))(position((start_p(""7 140 143))(end_p(""7 140 148)))))(((value(ForallTy(((value(TId `a))(position((start_p(""6 109 116))(end_p(""6 109 118)))))((value(TId `b))(position((start_p(""6 109 120))(end_p(""6 109 122))))))((value(TyArrow((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""6 109 126))(end_p(""6 109 128)))))((value(TyVar(TId `b)))(position((start_p(""6 109 130))(end_p(""6 109 132))))))))(position((start_p(""6 109 124))(end_p(""6 109 133)))))((value(TyVar(TId `b)))(position((start_p(""6 109 137))(end_p(""6 109 139)))))))(position((start_p(""6 109 124))(end_p(""6 109 139)))))))(position((start_p(""6 109 115))(end_p(""6 109 139))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id p))(position((start_p(""7 140 150))(end_p(""7 140 151)))))))(position((start_p(""7 140 150))(end_p(""7 140 151)))))((value(TyCon(TCon p)(((value(TyVar(TId `a)))(position((start_p(""7 140 156))(end_p(""7 140 158)))))((value(TyVar(TId `b)))(position((start_p(""7 140 160))(end_p(""7 140 162))))))))(position((start_p(""7 140 154))(end_p(""7 140 163)))))))(position((start_p(""7 140 149))(end_p(""7 140 164)))))((value(Field((value(Variable((value(Id p))(position((start_p(""7 140 167))(end_p(""7 140 168)))))()))(position((start_p(""7 140 167))(end_p(""7 140 168)))))((value(LId y))(position((start_p(""7 140 169))(end_p(""7 140 170)))))((((value(TyVar(TId `a)))(position((start_p(""7 140 171))(end_p(""7 140 173)))))((value(TyVar(TId `b)))(position((start_p(""7 140 175))(end_p(""7 140 177)))))))))(position((start_p(""7 140 167))(end_p(""7 140 178)))))))))))(position((start_p(""6 109 109))(end_p(""7 140 178)))))((value(DefineValue(SimpleValue(((value(Id p))(position((start_p(""9 180 184))(end_p(""9 180 185)))))(((value(ForallTy()((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""9 180 190))(end_p(""9 180 193)))))((value(TyCon(TCon string)()))(position((start_p(""9 180 195))(end_p(""9 180 201))))))))(position((start_p(""9 180 188))(end_p(""9 180 202)))))))(position((start_p(""9 180 188))(end_p(""9 180 202))))))((value(Record((((value(LId x))(position((start_p(""9 180 207))(end_p(""9 180 208)))))((value(Literal((value(LInt 37))(position((start_p(""9 180 211))(end_p(""9 180 213)))))))(position((start_p(""9 180 211))(end_p(""9 180 213))))))(((value(LId y))(position((start_p(""9 180 215))(end_p(""9 180 216)))))((value(Literal((value(LString"Rory Williams"))(position((start_p(""9 180 233))(end_p(""9 180 234)))))))(position((start_p(""9 180 233))(end_p(""9 180 234)))))))((((value(TyCon(TCon int)()))(position((start_p(""9 180 237))(end_p(""9 180 240)))))((value(TyCon(TCon string)()))(position((start_p(""9 180 242))(end_p(""9 180 248)))))))))(position((start_p(""9 180 205))(end_p(""9 180 249)))))))))(position((start_p(""9 180 180))(end_p(""9 180 249)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""11 251 255))(end_p(""11 251 256)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""11 251 259))(end_p(""11 251 262)))))))(position((start_p(""11 251 259))(end_p(""11 251 262))))))((value(Apply((value(Variable((value(Id get_x))(position((start_p(""11 251 265))(end_p(""11 251 270)))))((((value(TyCon(TCon int)()))(position((start_p(""11 251 271))(end_p(""11 251 274)))))((value(TyCon(TCon string)()))(position((start_p(""11 251 276))(end_p(""11 251 282)))))))))(position((start_p(""11 251 265))(end_p(""11 251 283)))))((value(Variable((value(Id p))(position((start_p(""11 251 284))(end_p(""11 251 285)))))()))(position((start_p(""11 251 283))(end_p(""11 251 286)))))))(position((start_p(""11 251 265))(end_p(""11 251 286)))))))))(position((start_p(""11 251 251))(end_p(""11 251 286)))))((value(DefineValue(SimpleValue(((value(Id y))(position((start_p(""13 288 292))(end_p(""13 288 293)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""13 288 296))(end_p(""13 288 302)))))))(position((start_p(""13 288 296))(end_p(""13 288 302))))))((value(Apply((value(Variable((value(Id get_y))(position((start_p(""13 288 305))(end_p(""13 288 310)))))((((value(TyCon(TCon int)()))(position((start_p(""13 288 311))(end_p(""13 288 314)))))((value(TyCon(TCon string)()))(position((start_p(""13 288 316))(end_p(""13 288 322)))))))))(position((start_p(""13 288 305))(end_p(""13 288 323)))))((value(Variable((value(Id p))(position((start_p(""13 288 324))(end_p(""13 288 325)))))()))(position((start_p(""13 288 323))(end_p(""13 288 326)))))))(position((start_p(""13 288 305))(end_p(""13 288 326)))))))))(position((start_p(""13 288 288))(end_p(""13 288 326)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix.human-readable b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix.human-readable new file mode 100644 index 0000000..8295765 --- /dev/null +++ b/flap/tests/03-Typing/26-function-over-polymorphic-record.good.typing.hopix.human-readable @@ -0,0 +1,13 @@ +type p<`a, `b> = { x : `a, y : `b } + +fun : [`a, `b] p<`a, `b> -> `a + get_x (p : p<`a, `b>) = p.x<`a, `b> + +fun : [`a, `b] p<`a, `b> -> `b + get_y (p : p<`a, `b>) = p.y<`a, `b> + +let p : p = { x = 37, y = "Rory Williams" } + +let x : int = get_x(p) + +let y : string = get_y(p) \ No newline at end of file diff --git a/flap/tests/03-Typing/27-function-in-record.bad.expected b/flap/tests/03-Typing/27-function-in-record.bad.expected new file mode 100644 index 0000000..43e21f5 --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Invalid number of types in instantiation: 1 given while 2 were expected. diff --git a/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix b/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix new file mode 100644 index 0000000..8f74bbd --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon f))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId apply))(position((start_p(""1 0 19))(end_p(""1 0 24)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 27))(end_p(""1 0 29)))))((value(TyVar(TId `b)))(position((start_p(""1 0 33))(end_p(""1 0 35)))))))(position((start_p(""1 0 27))(end_p(""1 0 35))))))))))(position((start_p(""1 0 0))(end_p(""1 0 37)))))((value(DefineValue(RecFunctions((((value(Id f))(position((start_p(""4 56 60))(end_p(""4 56 61)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 39 45))(end_p(""3 39 48)))))((value(TyCon(TCon int)()))(position((start_p(""3 39 52))(end_p(""3 39 55)))))))(position((start_p(""3 39 45))(end_p(""3 39 55)))))))(position((start_p(""3 39 45))(end_p(""3 39 55))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 56 63))(end_p(""4 56 64)))))))(position((start_p(""4 56 63))(end_p(""4 56 64)))))((value(TyCon(TCon int)()))(position((start_p(""4 56 67))(end_p(""4 56 70)))))))(position((start_p(""4 56 62))(end_p(""4 56 71)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 56 76))(end_p(""4 56 77)))))()))(position((start_p(""4 56 76))(end_p(""4 56 77)))))((value(Variable((value(Id x))(position((start_p(""4 56 74))(end_p(""4 56 75)))))()))(position((start_p(""4 56 74))(end_p(""4 56 75)))))))(position((start_p(""4 56 74))(end_p(""4 56 75)))))((value(Literal((value(LInt 1))(position((start_p(""4 56 78))(end_p(""4 56 79)))))))(position((start_p(""4 56 78))(end_p(""4 56 79)))))))(position((start_p(""4 56 74))(end_p(""4 56 79)))))))))))(position((start_p(""3 39 39))(end_p(""4 56 79)))))((value(DefineValue(SimpleValue(((value(Id boxed_f))(position((start_p(""6 81 85))(end_p(""6 81 92)))))(((value(ForallTy()((value(TyCon(TCon f)(((value(TyCon(TCon int)()))(position((start_p(""6 81 97))(end_p(""6 81 100)))))((value(TyCon(TCon int)()))(position((start_p(""6 81 102))(end_p(""6 81 105))))))))(position((start_p(""6 81 95))(end_p(""6 81 106)))))))(position((start_p(""6 81 95))(end_p(""6 81 106))))))((value(Record((((value(LId apply))(position((start_p(""6 81 111))(end_p(""6 81 116)))))((value(Variable((value(Id f))(position((start_p(""6 81 119))(end_p(""6 81 120)))))()))(position((start_p(""6 81 119))(end_p(""6 81 120)))))))((((value(TyCon(TCon int)()))(position((start_p(""6 81 123))(end_p(""6 81 126)))))((value(TyCon(TCon int)()))(position((start_p(""6 81 128))(end_p(""6 81 131)))))))))(position((start_p(""6 81 109))(end_p(""6 81 132)))))))))(position((start_p(""6 81 81))(end_p(""6 81 132)))))((value(DefineValue(RecFunctions((((value(Id apply_boxed_f))(position((start_p(""9 170 174))(end_p(""9 170 187)))))(((value(ForallTy(((value(TId `a))(position((start_p(""8 134 141))(end_p(""8 134 143)))))((value(TId `b))(position((start_p(""8 134 145))(end_p(""8 134 147))))))((value(TyArrow((value(TyTuple(((value(TyCon(TCon f)(((value(TyVar(TId `a)))(position((start_p(""8 134 151))(end_p(""8 134 153)))))((value(TyVar(TId `b)))(position((start_p(""8 134 155))(end_p(""8 134 157))))))))(position((start_p(""8 134 149))(end_p(""8 134 158)))))((value(TyVar(TId `a)))(position((start_p(""8 134 161))(end_p(""8 134 163))))))))(position((start_p(""8 134 149))(end_p(""8 134 163)))))((value(TyVar(TId `b)))(position((start_p(""8 134 167))(end_p(""8 134 169)))))))(position((start_p(""8 134 149))(end_p(""8 134 169)))))))(position((start_p(""8 134 140))(end_p(""8 134 169))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id boxed_f))(position((start_p(""9 170 190))(end_p(""9 170 197)))))))(position((start_p(""9 170 190))(end_p(""9 170 197)))))((value(TyCon(TCon f)(((value(TyVar(TId `a)))(position((start_p(""9 170 202))(end_p(""9 170 204)))))((value(TyVar(TId `b)))(position((start_p(""9 170 206))(end_p(""9 170 208))))))))(position((start_p(""9 170 200))(end_p(""9 170 209)))))))(position((start_p(""9 170 189))(end_p(""9 170 210)))))((value(PTypeAnnotation((value(PVariable((value(Id a))(position((start_p(""9 170 213))(end_p(""9 170 214)))))))(position((start_p(""9 170 213))(end_p(""9 170 214)))))((value(TyVar(TId `a)))(position((start_p(""9 170 217))(end_p(""9 170 219)))))))(position((start_p(""9 170 212))(end_p(""9 170 220))))))))(position((start_p(""9 170 188))(end_p(""9 170 221)))))((value(Apply((value(Field((value(Variable((value(Id boxed_f))(position((start_p(""9 170 224))(end_p(""9 170 231)))))()))(position((start_p(""9 170 224))(end_p(""9 170 231)))))((value(LId apply))(position((start_p(""9 170 232))(end_p(""9 170 237)))))((((value(TyVar(TId `a)))(position((start_p(""9 170 238))(end_p(""9 170 240)))))((value(TyVar(TId `b)))(position((start_p(""9 170 242))(end_p(""9 170 244)))))))))(position((start_p(""9 170 224))(end_p(""9 170 245)))))((value(Variable((value(Id a))(position((start_p(""9 170 247))(end_p(""9 170 248)))))()))(position((start_p(""9 170 246))(end_p(""9 170 249)))))))(position((start_p(""9 170 224))(end_p(""9 170 249)))))))))))(position((start_p(""8 134 134))(end_p(""9 170 249)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""11 251 255))(end_p(""11 251 259)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""11 251 262))(end_p(""11 251 265)))))))(position((start_p(""11 251 262))(end_p(""11 251 265))))))((value(Apply((value(Variable((value(Id apply_boxed_f))(position((start_p(""11 251 268))(end_p(""11 251 281)))))((((value(TyCon(TCon int)()))(position((start_p(""11 251 282))(end_p(""11 251 285)))))))))(position((start_p(""11 251 268))(end_p(""11 251 286)))))((value(Tuple(((value(Variable((value(Id boxed_f))(position((start_p(""11 251 287))(end_p(""11 251 294)))))()))(position((start_p(""11 251 287))(end_p(""11 251 294)))))((value(Literal((value(LInt 42))(position((start_p(""11 251 296))(end_p(""11 251 298)))))))(position((start_p(""11 251 296))(end_p(""11 251 298))))))))(position((start_p(""11 251 286))(end_p(""11 251 299)))))))(position((start_p(""11 251 268))(end_p(""11 251 299)))))))))(position((start_p(""11 251 251))(end_p(""11 251 299)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix.human-readable b/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix.human-readable new file mode 100644 index 0000000..7142e9c --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.bad.typing.hopix.human-readable @@ -0,0 +1,11 @@ +type f<`a, `b> = { apply : `a -> `b } + +fun : int -> int + f (x : int) = x + 1 + +let boxed_f : f = { apply = f } + +fun : [`a, `b] f<`a, `b> * `a -> `b + apply_boxed_f ((boxed_f : f<`a, `b>), (a : `a)) = boxed_f.apply<`a, `b> (a) + +let main : int = apply_boxed_f(boxed_f, 42) \ No newline at end of file diff --git a/flap/tests/03-Typing/27-function-in-record.good.expected b/flap/tests/03-Typing/27-function-in-record.good.expected new file mode 100644 index 0000000..b2bf1d4 --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.good.expected @@ -0,0 +1,4 @@ +f : int -> int +boxed_f : f +apply_boxed_f : [`a, `b] f<`a, `b> * `a -> `b +main : int diff --git a/flap/tests/03-Typing/27-function-in-record.good.typing.hopix b/flap/tests/03-Typing/27-function-in-record.good.typing.hopix new file mode 100644 index 0000000..1fb3cbd --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon f))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineRecordType((((value(LId apply))(position((start_p(""1 0 19))(end_p(""1 0 24)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 27))(end_p(""1 0 29)))))((value(TyVar(TId `b)))(position((start_p(""1 0 33))(end_p(""1 0 35)))))))(position((start_p(""1 0 27))(end_p(""1 0 35))))))))))(position((start_p(""1 0 0))(end_p(""1 0 37)))))((value(DefineValue(RecFunctions((((value(Id f))(position((start_p(""4 56 60))(end_p(""4 56 61)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 39 45))(end_p(""3 39 48)))))((value(TyCon(TCon int)()))(position((start_p(""3 39 52))(end_p(""3 39 55)))))))(position((start_p(""3 39 45))(end_p(""3 39 55)))))))(position((start_p(""3 39 45))(end_p(""3 39 55))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 56 63))(end_p(""4 56 64)))))))(position((start_p(""4 56 63))(end_p(""4 56 64)))))((value(TyCon(TCon int)()))(position((start_p(""4 56 67))(end_p(""4 56 70)))))))(position((start_p(""4 56 62))(end_p(""4 56 71)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 56 76))(end_p(""4 56 77)))))()))(position((start_p(""4 56 76))(end_p(""4 56 77)))))((value(Variable((value(Id x))(position((start_p(""4 56 74))(end_p(""4 56 75)))))()))(position((start_p(""4 56 74))(end_p(""4 56 75)))))))(position((start_p(""4 56 74))(end_p(""4 56 75)))))((value(Literal((value(LInt 1))(position((start_p(""4 56 78))(end_p(""4 56 79)))))))(position((start_p(""4 56 78))(end_p(""4 56 79)))))))(position((start_p(""4 56 74))(end_p(""4 56 79)))))))))))(position((start_p(""3 39 39))(end_p(""4 56 79)))))((value(DefineValue(SimpleValue(((value(Id boxed_f))(position((start_p(""6 81 85))(end_p(""6 81 92)))))(((value(ForallTy()((value(TyCon(TCon f)(((value(TyCon(TCon int)()))(position((start_p(""6 81 97))(end_p(""6 81 100)))))((value(TyCon(TCon int)()))(position((start_p(""6 81 102))(end_p(""6 81 105))))))))(position((start_p(""6 81 95))(end_p(""6 81 106)))))))(position((start_p(""6 81 95))(end_p(""6 81 106))))))((value(Record((((value(LId apply))(position((start_p(""6 81 111))(end_p(""6 81 116)))))((value(Variable((value(Id f))(position((start_p(""6 81 119))(end_p(""6 81 120)))))()))(position((start_p(""6 81 119))(end_p(""6 81 120)))))))((((value(TyCon(TCon int)()))(position((start_p(""6 81 123))(end_p(""6 81 126)))))((value(TyCon(TCon int)()))(position((start_p(""6 81 128))(end_p(""6 81 131)))))))))(position((start_p(""6 81 109))(end_p(""6 81 132)))))))))(position((start_p(""6 81 81))(end_p(""6 81 132)))))((value(DefineValue(RecFunctions((((value(Id apply_boxed_f))(position((start_p(""9 170 174))(end_p(""9 170 187)))))(((value(ForallTy(((value(TId `a))(position((start_p(""8 134 141))(end_p(""8 134 143)))))((value(TId `b))(position((start_p(""8 134 145))(end_p(""8 134 147))))))((value(TyArrow((value(TyTuple(((value(TyCon(TCon f)(((value(TyVar(TId `a)))(position((start_p(""8 134 151))(end_p(""8 134 153)))))((value(TyVar(TId `b)))(position((start_p(""8 134 155))(end_p(""8 134 157))))))))(position((start_p(""8 134 149))(end_p(""8 134 158)))))((value(TyVar(TId `a)))(position((start_p(""8 134 161))(end_p(""8 134 163))))))))(position((start_p(""8 134 149))(end_p(""8 134 163)))))((value(TyVar(TId `b)))(position((start_p(""8 134 167))(end_p(""8 134 169)))))))(position((start_p(""8 134 149))(end_p(""8 134 169)))))))(position((start_p(""8 134 140))(end_p(""8 134 169))))))(FunctionDefinition((value(PTuple(((value(PTypeAnnotation((value(PVariable((value(Id boxed_f))(position((start_p(""9 170 190))(end_p(""9 170 197)))))))(position((start_p(""9 170 190))(end_p(""9 170 197)))))((value(TyCon(TCon f)(((value(TyVar(TId `a)))(position((start_p(""9 170 202))(end_p(""9 170 204)))))((value(TyVar(TId `b)))(position((start_p(""9 170 206))(end_p(""9 170 208))))))))(position((start_p(""9 170 200))(end_p(""9 170 209)))))))(position((start_p(""9 170 189))(end_p(""9 170 210)))))((value(PTypeAnnotation((value(PVariable((value(Id a))(position((start_p(""9 170 213))(end_p(""9 170 214)))))))(position((start_p(""9 170 213))(end_p(""9 170 214)))))((value(TyVar(TId `a)))(position((start_p(""9 170 217))(end_p(""9 170 219)))))))(position((start_p(""9 170 212))(end_p(""9 170 220))))))))(position((start_p(""9 170 188))(end_p(""9 170 221)))))((value(Apply((value(Field((value(Variable((value(Id boxed_f))(position((start_p(""9 170 224))(end_p(""9 170 231)))))()))(position((start_p(""9 170 224))(end_p(""9 170 231)))))((value(LId apply))(position((start_p(""9 170 232))(end_p(""9 170 237)))))((((value(TyVar(TId `a)))(position((start_p(""9 170 238))(end_p(""9 170 240)))))((value(TyVar(TId `b)))(position((start_p(""9 170 242))(end_p(""9 170 244)))))))))(position((start_p(""9 170 224))(end_p(""9 170 245)))))((value(Variable((value(Id a))(position((start_p(""9 170 247))(end_p(""9 170 248)))))()))(position((start_p(""9 170 246))(end_p(""9 170 249)))))))(position((start_p(""9 170 224))(end_p(""9 170 249)))))))))))(position((start_p(""8 134 134))(end_p(""9 170 249)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""11 251 255))(end_p(""11 251 259)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""11 251 262))(end_p(""11 251 265)))))))(position((start_p(""11 251 262))(end_p(""11 251 265))))))((value(Apply((value(Variable((value(Id apply_boxed_f))(position((start_p(""11 251 268))(end_p(""11 251 281)))))((((value(TyCon(TCon int)()))(position((start_p(""11 251 282))(end_p(""11 251 285)))))((value(TyCon(TCon int)()))(position((start_p(""11 251 287))(end_p(""11 251 290)))))))))(position((start_p(""11 251 268))(end_p(""11 251 291)))))((value(Tuple(((value(Variable((value(Id boxed_f))(position((start_p(""11 251 292))(end_p(""11 251 299)))))()))(position((start_p(""11 251 292))(end_p(""11 251 299)))))((value(Literal((value(LInt 42))(position((start_p(""11 251 301))(end_p(""11 251 303)))))))(position((start_p(""11 251 301))(end_p(""11 251 303))))))))(position((start_p(""11 251 291))(end_p(""11 251 304)))))))(position((start_p(""11 251 268))(end_p(""11 251 304)))))))))(position((start_p(""11 251 251))(end_p(""11 251 304)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/27-function-in-record.good.typing.hopix.human-readable b/flap/tests/03-Typing/27-function-in-record.good.typing.hopix.human-readable new file mode 100644 index 0000000..0975509 --- /dev/null +++ b/flap/tests/03-Typing/27-function-in-record.good.typing.hopix.human-readable @@ -0,0 +1,11 @@ +type f<`a, `b> = { apply : `a -> `b } + +fun : int -> int + f (x : int) = x + 1 + +let boxed_f : f = { apply = f } + +fun : [`a, `b] f<`a, `b> * `a -> `b + apply_boxed_f ((boxed_f : f<`a, `b>), (a : `a)) = boxed_f.apply<`a, `b> (a) + +let main : int = apply_boxed_f(boxed_f, 42) \ No newline at end of file diff --git a/flap/tests/03-Typing/28-anonymous-function.bad.expected b/flap/tests/03-Typing/28-anonymous-function.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix b/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix new file mode 100644 index 0000000..cbc412c --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id succ))(position((start_p(""1 0 4))(end_p(""1 0 8)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 11))(end_p(""1 0 14)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 18))(end_p(""1 0 21)))))))(position((start_p(""1 0 11))(end_p(""1 0 21)))))))(position((start_p(""1 0 11))(end_p(""1 0 21))))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 28))(end_p(""1 0 29)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 32))(end_p(""1 0 35)))))))(position((start_p(""1 0 27))(end_p(""1 0 36)))))((value(Literal((value(LString bar))(position((start_p(""1 0 44))(end_p(""1 0 45)))))))(position((start_p(""1 0 44))(end_p(""1 0 45))))))))(position((start_p(""1 0 25))(end_p(""1 0 45)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 48))(end_p(""1 0 51)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 55))(end_p(""1 0 58)))))))(position((start_p(""1 0 48))(end_p(""1 0 58)))))))(position((start_p(""1 0 24))(end_p(""1 0 59)))))))))(position((start_p(""1 0 0))(end_p(""1 0 59)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 61 65))(end_p(""3 61 69)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 61 72))(end_p(""3 61 75)))))))(position((start_p(""3 61 72))(end_p(""3 61 75))))))((value(Apply((value(Variable((value(Id succ))(position((start_p(""3 61 78))(end_p(""3 61 82)))))()))(position((start_p(""3 61 78))(end_p(""3 61 82)))))((value(Literal((value(LInt 0))(position((start_p(""3 61 84))(end_p(""3 61 85)))))))(position((start_p(""3 61 83))(end_p(""3 61 86)))))))(position((start_p(""3 61 78))(end_p(""3 61 86)))))))))(position((start_p(""3 61 61))(end_p(""3 61 86)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix.human-readable b/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix.human-readable new file mode 100644 index 0000000..5df9fe8 --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +let succ : int -> int = (\ (x : int) -> "bar" : int -> int) + +let main : int = succ (0) \ No newline at end of file diff --git a/flap/tests/03-Typing/28-anonymous-function.good.expected b/flap/tests/03-Typing/28-anonymous-function.good.expected new file mode 100644 index 0000000..4c85903 --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.good.expected @@ -0,0 +1,2 @@ +succ : int -> int +main : int diff --git a/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix b/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix new file mode 100644 index 0000000..f834ca9 --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id succ))(position((start_p(""1 0 4))(end_p(""1 0 8)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 11))(end_p(""1 0 14)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 18))(end_p(""1 0 21)))))))(position((start_p(""1 0 11))(end_p(""1 0 21)))))))(position((start_p(""1 0 11))(end_p(""1 0 21))))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 28))(end_p(""1 0 29)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 32))(end_p(""1 0 35)))))))(position((start_p(""1 0 27))(end_p(""1 0 36)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""1 0 42))(end_p(""1 0 43)))))()))(position((start_p(""1 0 42))(end_p(""1 0 43)))))((value(Variable((value(Id x))(position((start_p(""1 0 40))(end_p(""1 0 41)))))()))(position((start_p(""1 0 40))(end_p(""1 0 41)))))))(position((start_p(""1 0 40))(end_p(""1 0 41)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 44))(end_p(""1 0 45)))))))(position((start_p(""1 0 44))(end_p(""1 0 45)))))))(position((start_p(""1 0 40))(end_p(""1 0 45))))))))(position((start_p(""1 0 25))(end_p(""1 0 45)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 48))(end_p(""1 0 51)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 55))(end_p(""1 0 58)))))))(position((start_p(""1 0 48))(end_p(""1 0 58)))))))(position((start_p(""1 0 24))(end_p(""1 0 59)))))))))(position((start_p(""1 0 0))(end_p(""1 0 59)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 61 65))(end_p(""3 61 69)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 61 72))(end_p(""3 61 75)))))))(position((start_p(""3 61 72))(end_p(""3 61 75))))))((value(Apply((value(Variable((value(Id succ))(position((start_p(""3 61 78))(end_p(""3 61 82)))))()))(position((start_p(""3 61 78))(end_p(""3 61 82)))))((value(Literal((value(LInt 0))(position((start_p(""3 61 84))(end_p(""3 61 85)))))))(position((start_p(""3 61 83))(end_p(""3 61 86)))))))(position((start_p(""3 61 78))(end_p(""3 61 86)))))))))(position((start_p(""3 61 61))(end_p(""3 61 86)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix.human-readable b/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix.human-readable new file mode 100644 index 0000000..12112b9 --- /dev/null +++ b/flap/tests/03-Typing/28-anonymous-function.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +let succ : int -> int = (\ (x : int) -> x + 1 : int -> int) + +let main : int = succ (0) \ No newline at end of file diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.bad.expected b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.expected new file mode 100644 index 0000000..cd8098a --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + int -> int diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix new file mode 100644 index 0000000..4478969 --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id apply))(position((start_p(""2 33 37))(end_p(""2 33 42)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 7))(end_p(""1 0 10)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 6))(end_p(""1 0 18)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 22))(end_p(""1 0 25)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 29))(end_p(""1 0 32)))))))(position((start_p(""1 0 22))(end_p(""1 0 32)))))))(position((start_p(""1 0 6))(end_p(""1 0 32)))))))(position((start_p(""1 0 6))(end_p(""1 0 32))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 33 44))(end_p(""2 33 45)))))))(position((start_p(""2 33 44))(end_p(""2 33 45)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""2 33 48))(end_p(""2 33 51)))))((value(TyCon(TCon int)()))(position((start_p(""2 33 55))(end_p(""2 33 58)))))))(position((start_p(""2 33 48))(end_p(""2 33 58)))))))(position((start_p(""2 33 43))(end_p(""2 33 59)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 62 69))(end_p(""3 62 70)))))))(position((start_p(""3 62 69))(end_p(""3 62 70)))))((value(TyCon(TCon int)()))(position((start_p(""3 62 73))(end_p(""3 62 76)))))))(position((start_p(""3 62 68))(end_p(""3 62 77)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""3 62 81))(end_p(""3 62 82)))))()))(position((start_p(""3 62 81))(end_p(""3 62 82)))))((value(Variable((value(Id x))(position((start_p(""3 62 84))(end_p(""3 62 85)))))()))(position((start_p(""3 62 83))(end_p(""3 62 86)))))))(position((start_p(""3 62 81))(end_p(""3 62 86))))))))(position((start_p(""3 62 67))(end_p(""3 62 86)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 62 89))(end_p(""3 62 92)))))((value(TyCon(TCon int)()))(position((start_p(""3 62 96))(end_p(""3 62 99)))))))(position((start_p(""3 62 89))(end_p(""3 62 99)))))))(position((start_p(""3 62 66))(end_p(""3 62 100)))))))))))(position((start_p(""1 0 0))(end_p(""3 62 100)))))((value(DefineValue(RecFunctions((((value(Id succ))(position((start_p(""6 119 123))(end_p(""6 119 127)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""5 102 108))(end_p(""5 102 111)))))((value(TyCon(TCon int)()))(position((start_p(""5 102 115))(end_p(""5 102 118)))))))(position((start_p(""5 102 108))(end_p(""5 102 118)))))))(position((start_p(""5 102 108))(end_p(""5 102 118))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""6 119 129))(end_p(""6 119 130)))))))(position((start_p(""6 119 129))(end_p(""6 119 130)))))((value(TyCon(TCon int)()))(position((start_p(""6 119 133))(end_p(""6 119 136)))))))(position((start_p(""6 119 128))(end_p(""6 119 137)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""6 119 142))(end_p(""6 119 143)))))()))(position((start_p(""6 119 142))(end_p(""6 119 143)))))((value(Variable((value(Id x))(position((start_p(""6 119 140))(end_p(""6 119 141)))))()))(position((start_p(""6 119 140))(end_p(""6 119 141)))))))(position((start_p(""6 119 140))(end_p(""6 119 141)))))((value(Literal((value(LInt 1))(position((start_p(""6 119 144))(end_p(""6 119 145)))))))(position((start_p(""6 119 144))(end_p(""6 119 145)))))))(position((start_p(""6 119 140))(end_p(""6 119 145)))))))))))(position((start_p(""5 102 102))(end_p(""6 119 145)))))((value(DefineValue(RecFunctions((((value(Id apply2))(position((start_p(""9 194 198))(end_p(""9 194 204)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 154))(end_p(""8 147 157)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 161))(end_p(""8 147 164)))))((value(TyCon(TCon int)()))(position((start_p(""8 147 168))(end_p(""8 147 171)))))))(position((start_p(""8 147 161))(end_p(""8 147 171)))))))(position((start_p(""8 147 153))(end_p(""8 147 172)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 176))(end_p(""8 147 179)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 183))(end_p(""8 147 186)))))((value(TyCon(TCon int)()))(position((start_p(""8 147 190))(end_p(""8 147 193)))))))(position((start_p(""8 147 183))(end_p(""8 147 193)))))))(position((start_p(""8 147 176))(end_p(""8 147 193)))))))(position((start_p(""8 147 153))(end_p(""8 147 193)))))))(position((start_p(""8 147 153))(end_p(""8 147 193))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""9 194 206))(end_p(""9 194 207)))))))(position((start_p(""9 194 206))(end_p(""9 194 207)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""9 194 210))(end_p(""9 194 213)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""9 194 217))(end_p(""9 194 220)))))((value(TyCon(TCon int)()))(position((start_p(""9 194 224))(end_p(""9 194 227)))))))(position((start_p(""9 194 217))(end_p(""9 194 227)))))))(position((start_p(""9 194 210))(end_p(""9 194 227)))))))(position((start_p(""9 194 205))(end_p(""9 194 228)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""10 231 238))(end_p(""10 231 239)))))))(position((start_p(""10 231 238))(end_p(""10 231 239)))))((value(TyCon(TCon int)()))(position((start_p(""10 231 242))(end_p(""10 231 245)))))))(position((start_p(""10 231 237))(end_p(""10 231 246)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""11 250 258))(end_p(""11 250 259)))))))(position((start_p(""11 250 258))(end_p(""11 250 259)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 262))(end_p(""11 250 265)))))))(position((start_p(""11 250 257))(end_p(""11 250 266)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""11 250 270))(end_p(""11 250 271)))))()))(position((start_p(""11 250 270))(end_p(""11 250 271)))))((value(Variable((value(Id x))(position((start_p(""11 250 272))(end_p(""11 250 273)))))()))(position((start_p(""11 250 272))(end_p(""11 250 273)))))))(position((start_p(""11 250 270))(end_p(""11 250 273)))))((value(Variable((value(Id y))(position((start_p(""11 250 274))(end_p(""11 250 275)))))()))(position((start_p(""11 250 274))(end_p(""11 250 275)))))))(position((start_p(""11 250 270))(end_p(""11 250 275))))))))(position((start_p(""11 250 256))(end_p(""11 250 275)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 278))(end_p(""11 250 281)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 285))(end_p(""11 250 288)))))))(position((start_p(""11 250 278))(end_p(""11 250 288)))))))(position((start_p(""11 250 255))(end_p(""11 250 289))))))))(position((start_p(""10 231 236))(end_p(""11 250 289)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 292))(end_p(""11 250 295)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 299))(end_p(""11 250 302)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 306))(end_p(""11 250 309)))))))(position((start_p(""11 250 299))(end_p(""11 250 309)))))))(position((start_p(""11 250 292))(end_p(""11 250 309)))))))(position((start_p(""10 231 235))(end_p(""11 250 310)))))))))))(position((start_p(""8 147 147))(end_p(""11 250 310)))))((value(DefineValue(RecFunctions((((value(Id addmul))(position((start_p(""14 336 341))(end_p(""14 336 347)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""13 312 318))(end_p(""13 312 321)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""13 312 325))(end_p(""13 312 328)))))((value(TyCon(TCon int)()))(position((start_p(""13 312 332))(end_p(""13 312 335)))))))(position((start_p(""13 312 325))(end_p(""13 312 335)))))))(position((start_p(""13 312 318))(end_p(""13 312 335)))))))(position((start_p(""13 312 318))(end_p(""13 312 335))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""14 336 349))(end_p(""14 336 350)))))))(position((start_p(""14 336 349))(end_p(""14 336 350)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 353))(end_p(""14 336 356)))))))(position((start_p(""14 336 348))(end_p(""14 336 357)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""14 336 363))(end_p(""14 336 364)))))))(position((start_p(""14 336 363))(end_p(""14 336 364)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 367))(end_p(""14 336 370)))))))(position((start_p(""14 336 362))(end_p(""14 336 371)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""14 336 381))(end_p(""14 336 382)))))()))(position((start_p(""14 336 381))(end_p(""14 336 382)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""14 336 377))(end_p(""14 336 378)))))()))(position((start_p(""14 336 377))(end_p(""14 336 378)))))((value(Variable((value(Id x))(position((start_p(""14 336 375))(end_p(""14 336 376)))))()))(position((start_p(""14 336 375))(end_p(""14 336 376)))))))(position((start_p(""14 336 375))(end_p(""14 336 376)))))((value(Variable((value(Id y))(position((start_p(""14 336 379))(end_p(""14 336 380)))))()))(position((start_p(""14 336 379))(end_p(""14 336 380)))))))(position((start_p(""14 336 375))(end_p(""14 336 380)))))))(position((start_p(""14 336 375))(end_p(""14 336 380)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""14 336 385))(end_p(""14 336 386)))))()))(position((start_p(""14 336 385))(end_p(""14 336 386)))))((value(Variable((value(Id y))(position((start_p(""14 336 383))(end_p(""14 336 384)))))()))(position((start_p(""14 336 383))(end_p(""14 336 384)))))))(position((start_p(""14 336 383))(end_p(""14 336 384)))))((value(Variable((value(Id x))(position((start_p(""14 336 387))(end_p(""14 336 388)))))()))(position((start_p(""14 336 387))(end_p(""14 336 388)))))))(position((start_p(""14 336 383))(end_p(""14 336 388)))))))(position((start_p(""14 336 375))(end_p(""14 336 388))))))))(position((start_p(""14 336 361))(end_p(""14 336 388)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""14 336 391))(end_p(""14 336 394)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 398))(end_p(""14 336 401)))))))(position((start_p(""14 336 391))(end_p(""14 336 401)))))))(position((start_p(""14 336 360))(end_p(""14 336 402)))))))))))(position((start_p(""13 312 312))(end_p(""14 336 402)))))((value(DefineValue(RecFunctions((((value(Id apply3))(position((start_p(""17 465 469))(end_p(""17 465 475)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 411))(end_p(""16 404 414)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 418))(end_p(""16 404 421)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 425))(end_p(""16 404 428)))))((value(TyCon(TCon int)()))(position((start_p(""16 404 432))(end_p(""16 404 435)))))))(position((start_p(""16 404 425))(end_p(""16 404 435)))))))(position((start_p(""16 404 418))(end_p(""16 404 435)))))))(position((start_p(""16 404 410))(end_p(""16 404 436)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 440))(end_p(""16 404 443)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 447))(end_p(""16 404 450)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 454))(end_p(""16 404 457)))))((value(TyCon(TCon int)()))(position((start_p(""16 404 461))(end_p(""16 404 464)))))))(position((start_p(""16 404 454))(end_p(""16 404 464)))))))(position((start_p(""16 404 447))(end_p(""16 404 464)))))))(position((start_p(""16 404 440))(end_p(""16 404 464)))))))(position((start_p(""16 404 410))(end_p(""16 404 464)))))))(position((start_p(""16 404 410))(end_p(""16 404 464))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""17 465 477))(end_p(""17 465 478)))))))(position((start_p(""17 465 477))(end_p(""17 465 478)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 481))(end_p(""17 465 484)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 488))(end_p(""17 465 491)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 495))(end_p(""17 465 498)))))((value(TyCon(TCon int)()))(position((start_p(""17 465 502))(end_p(""17 465 505)))))))(position((start_p(""17 465 495))(end_p(""17 465 505)))))))(position((start_p(""17 465 488))(end_p(""17 465 505)))))))(position((start_p(""17 465 481))(end_p(""17 465 505)))))))(position((start_p(""17 465 476))(end_p(""17 465 506)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""18 509 516))(end_p(""18 509 517)))))))(position((start_p(""18 509 516))(end_p(""18 509 517)))))((value(TyCon(TCon int)()))(position((start_p(""18 509 520))(end_p(""18 509 523)))))))(position((start_p(""18 509 515))(end_p(""18 509 524)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""19 528 537))(end_p(""19 528 538)))))))(position((start_p(""19 528 537))(end_p(""19 528 538)))))((value(TyCon(TCon int)()))(position((start_p(""19 528 541))(end_p(""19 528 544)))))))(position((start_p(""19 528 536))(end_p(""19 528 545)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id z))(position((start_p(""20 549 560))(end_p(""20 549 561)))))))(position((start_p(""20 549 560))(end_p(""20 549 561)))))((value(TyCon(TCon int)()))(position((start_p(""20 549 564))(end_p(""20 549 567)))))))(position((start_p(""20 549 559))(end_p(""20 549 568)))))((value(Apply((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""20 549 572))(end_p(""20 549 573)))))()))(position((start_p(""20 549 572))(end_p(""20 549 573)))))((value(Variable((value(Id x))(position((start_p(""20 549 574))(end_p(""20 549 575)))))()))(position((start_p(""20 549 574))(end_p(""20 549 575)))))))(position((start_p(""20 549 572))(end_p(""20 549 575)))))((value(Variable((value(Id y))(position((start_p(""20 549 576))(end_p(""20 549 577)))))()))(position((start_p(""20 549 576))(end_p(""20 549 577)))))))(position((start_p(""20 549 572))(end_p(""20 549 577)))))((value(Variable((value(Id z))(position((start_p(""20 549 578))(end_p(""20 549 579)))))()))(position((start_p(""20 549 578))(end_p(""20 549 579)))))))(position((start_p(""20 549 572))(end_p(""20 549 579))))))))(position((start_p(""20 549 558))(end_p(""20 549 579)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""20 549 582))(end_p(""20 549 585)))))((value(TyCon(TCon int)()))(position((start_p(""20 549 589))(end_p(""20 549 592)))))))(position((start_p(""20 549 582))(end_p(""20 549 592)))))))(position((start_p(""20 549 557))(end_p(""20 549 593))))))))(position((start_p(""19 528 535))(end_p(""20 549 593)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""21 594 602))(end_p(""21 594 605)))))((value(TyCon(TCon int)()))(position((start_p(""21 594 609))(end_p(""21 594 612)))))))(position((start_p(""21 594 602))(end_p(""21 594 612)))))))(position((start_p(""19 528 534))(end_p(""21 594 613))))))))(position((start_p(""18 509 514))(end_p(""21 594 613)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 614 620))(end_p(""22 614 623)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 614 627))(end_p(""22 614 630)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 614 634))(end_p(""22 614 637)))))((value(TyCon(TCon int)()))(position((start_p(""22 614 641))(end_p(""22 614 644)))))))(position((start_p(""22 614 634))(end_p(""22 614 644)))))))(position((start_p(""22 614 627))(end_p(""22 614 644)))))))(position((start_p(""22 614 620))(end_p(""22 614 644)))))))(position((start_p(""18 509 513))(end_p(""22 614 645)))))))))))(position((start_p(""16 404 404))(end_p(""22 614 645)))))((value(DefineValue(SimpleValue(((value(Id conj))(position((start_p(""24 647 651))(end_p(""24 647 655)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 647 658))(end_p(""24 647 661)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 647 665))(end_p(""24 647 668)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 647 672))(end_p(""24 647 675)))))((value(TyCon(TCon int)()))(position((start_p(""24 647 679))(end_p(""24 647 682)))))))(position((start_p(""24 647 672))(end_p(""24 647 682)))))))(position((start_p(""24 647 665))(end_p(""24 647 682)))))))(position((start_p(""24 647 658))(end_p(""24 647 682)))))))(position((start_p(""24 647 658))(end_p(""24 647 682))))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""25 685 692))(end_p(""25 685 693)))))))(position((start_p(""25 685 692))(end_p(""25 685 693)))))((value(TyCon(TCon int)()))(position((start_p(""25 685 696))(end_p(""25 685 699)))))))(position((start_p(""25 685 691))(end_p(""25 685 700)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""26 704 714))(end_p(""26 704 715)))))))(position((start_p(""26 704 714))(end_p(""26 704 715)))))((value(TyCon(TCon int)()))(position((start_p(""26 704 718))(end_p(""26 704 721)))))))(position((start_p(""26 704 713))(end_p(""26 704 722)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id z))(position((start_p(""27 726 738))(end_p(""27 726 739)))))))(position((start_p(""27 726 738))(end_p(""27 726 739)))))((value(TyCon(TCon int)()))(position((start_p(""27 726 742))(end_p(""27 726 745)))))))(position((start_p(""27 726 737))(end_p(""27 726 746)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""27 726 756))(end_p(""27 726 757)))))()))(position((start_p(""27 726 756))(end_p(""27 726 757)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""27 726 752))(end_p(""27 726 753)))))()))(position((start_p(""27 726 752))(end_p(""27 726 753)))))((value(Variable((value(Id x))(position((start_p(""27 726 750))(end_p(""27 726 751)))))()))(position((start_p(""27 726 750))(end_p(""27 726 751)))))))(position((start_p(""27 726 750))(end_p(""27 726 751)))))((value(Variable((value(Id y))(position((start_p(""27 726 754))(end_p(""27 726 755)))))()))(position((start_p(""27 726 754))(end_p(""27 726 755)))))))(position((start_p(""27 726 750))(end_p(""27 726 755)))))))(position((start_p(""27 726 750))(end_p(""27 726 755)))))((value(Variable((value(Id z))(position((start_p(""27 726 758))(end_p(""27 726 759)))))()))(position((start_p(""27 726 758))(end_p(""27 726 759)))))))(position((start_p(""27 726 750))(end_p(""27 726 759))))))))(position((start_p(""27 726 736))(end_p(""27 726 759)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""27 726 762))(end_p(""27 726 765)))))((value(TyCon(TCon int)()))(position((start_p(""27 726 769))(end_p(""27 726 772)))))))(position((start_p(""27 726 762))(end_p(""27 726 772)))))))(position((start_p(""27 726 735))(end_p(""27 726 773))))))))(position((start_p(""26 704 712))(end_p(""27 726 773)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""28 774 783))(end_p(""28 774 786)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""28 774 790))(end_p(""28 774 793)))))((value(TyCon(TCon int)()))(position((start_p(""28 774 797))(end_p(""28 774 800)))))))(position((start_p(""28 774 790))(end_p(""28 774 800)))))))(position((start_p(""28 774 783))(end_p(""28 774 800)))))))(position((start_p(""26 704 711))(end_p(""28 774 801))))))))(position((start_p(""25 685 690))(end_p(""28 774 801)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 802 808))(end_p(""29 802 811)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 802 815))(end_p(""29 802 818)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 802 822))(end_p(""29 802 825)))))((value(TyCon(TCon int)()))(position((start_p(""29 802 829))(end_p(""29 802 832)))))))(position((start_p(""29 802 822))(end_p(""29 802 832)))))))(position((start_p(""29 802 815))(end_p(""29 802 832)))))))(position((start_p(""29 802 808))(end_p(""29 802 832)))))))(position((start_p(""25 685 689))(end_p(""29 802 833)))))))))(position((start_p(""24 647 647))(end_p(""29 802 833)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""31 835 839))(end_p(""31 835 843)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""31 835 846))(end_p(""31 835 849)))))))(position((start_p(""31 835 846))(end_p(""31 835 849))))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""33 874 896))(end_p(""33 874 897)))))()))(position((start_p(""33 874 896))(end_p(""33 874 897)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""32 852 872))(end_p(""32 852 873)))))()))(position((start_p(""32 852 872))(end_p(""32 852 873)))))((value(Apply((value(Apply((value(Variable((value(Id apply))(position((start_p(""32 852 856))(end_p(""32 852 861)))))()))(position((start_p(""32 852 856))(end_p(""32 852 861)))))((value(Variable((value(Id succ))(position((start_p(""32 852 862))(end_p(""32 852 866)))))()))(position((start_p(""32 852 862))(end_p(""32 852 866)))))))(position((start_p(""32 852 856))(end_p(""32 852 866)))))((value(Literal((value(LInt -1))(position((start_p(""32 852 868))(end_p(""32 852 870)))))))(position((start_p(""32 852 867))(end_p(""32 852 871)))))))(position((start_p(""32 852 856))(end_p(""32 852 871)))))))(position((start_p(""32 852 856))(end_p(""32 852 871)))))((value(Apply((value(Apply((value(Apply((value(Variable((value(Id apply2))(position((start_p(""33 874 878))(end_p(""33 874 884)))))()))(position((start_p(""33 874 878))(end_p(""33 874 884)))))((value(Variable((value(Id addmul))(position((start_p(""33 874 885))(end_p(""33 874 891)))))()))(position((start_p(""33 874 885))(end_p(""33 874 891)))))))(position((start_p(""33 874 878))(end_p(""33 874 891)))))((value(Literal((value(LInt 3))(position((start_p(""33 874 892))(end_p(""33 874 893)))))))(position((start_p(""33 874 892))(end_p(""33 874 893)))))))(position((start_p(""33 874 878))(end_p(""33 874 893)))))((value(Literal((value(LInt 7))(position((start_p(""33 874 894))(end_p(""33 874 895)))))))(position((start_p(""33 874 894))(end_p(""33 874 895)))))))(position((start_p(""33 874 878))(end_p(""33 874 895)))))))(position((start_p(""32 852 856))(end_p(""33 874 895)))))))(position((start_p(""32 852 856))(end_p(""33 874 895)))))((value(Apply((value(Apply((value(Apply((value(Apply((value(Variable((value(Id apply3))(position((start_p(""34 898 902))(end_p(""34 898 908)))))()))(position((start_p(""34 898 902))(end_p(""34 898 908)))))((value(Variable((value(Id conj))(position((start_p(""34 898 909))(end_p(""34 898 913)))))()))(position((start_p(""34 898 909))(end_p(""34 898 913)))))))(position((start_p(""34 898 902))(end_p(""34 898 913)))))((value(Literal((value(LInt 0))(position((start_p(""34 898 914))(end_p(""34 898 915)))))))(position((start_p(""34 898 914))(end_p(""34 898 915)))))))(position((start_p(""34 898 902))(end_p(""34 898 915)))))((value(Literal((value(LInt 1))(position((start_p(""34 898 916))(end_p(""34 898 917)))))))(position((start_p(""34 898 916))(end_p(""34 898 917)))))))(position((start_p(""34 898 902))(end_p(""34 898 917)))))((value(Literal((value(LInt 2))(position((start_p(""34 898 918))(end_p(""34 898 919)))))))(position((start_p(""34 898 918))(end_p(""34 898 919)))))))(position((start_p(""34 898 902))(end_p(""34 898 919)))))))(position((start_p(""32 852 856))(end_p(""34 898 919)))))))))(position((start_p(""31 835 835))(end_p(""34 898 919)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix.human-readable b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix.human-readable new file mode 100644 index 0000000..e22797b --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.bad.typing.hopix.human-readable @@ -0,0 +1,37 @@ +fun : (int -> int) -> int -> int + apply (f : int -> int) = + (\(x : int) -> f (x) : int -> int) + +fun : int -> int + succ (x : int) = x + 1 + +fun : (int -> int -> int) -> int -> int -> int + apply2 (f : int -> int -> int) = + (\(x : int) -> + (\(y : int) -> f x y : int -> int) : int -> int -> int) + +fun : int -> int -> int + addmul (x : int) = (\(y : int) -> x * y + y * x : int -> int) + +fun : (int -> int -> int -> int) -> int -> int -> int -> int + apply3 (f : int -> int -> int -> int) = + (\(x : int) -> + (\(y : int) -> + (\(z : int) -> f x y z : int -> int) + : int -> int) + : int -> int -> int -> int) + +let conj : int -> int -> int -> int = + (\(x : int) -> + (\(y : int) -> + (\(z : int) -> x * y * z : int -> int) + : int -> int -> int) + : int -> int -> int -> int) + +let main : int = + apply succ (-1) + + apply2 addmul 3 7 + + apply3 conj 0 1 2 + + + diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.good.expected b/flap/tests/03-Typing/29-anonymous-nary-functions.good.expected new file mode 100644 index 0000000..43e1460 --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.good.expected @@ -0,0 +1,7 @@ +apply : (int -> int) -> (int -> int) +succ : int -> int +apply2 : (int -> (int -> int)) -> (int -> (int -> int)) +addmul : int -> (int -> int) +apply3 : (int -> (int -> (int -> int))) -> (int -> (int -> (int -> int))) +conj : int -> (int -> (int -> int)) +main : int diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix b/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix new file mode 100644 index 0000000..e4cce39 --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id apply))(position((start_p(""2 33 37))(end_p(""2 33 42)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 7))(end_p(""1 0 10)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 14))(end_p(""1 0 17)))))))(position((start_p(""1 0 6))(end_p(""1 0 18)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""1 0 22))(end_p(""1 0 25)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 29))(end_p(""1 0 32)))))))(position((start_p(""1 0 22))(end_p(""1 0 32)))))))(position((start_p(""1 0 6))(end_p(""1 0 32)))))))(position((start_p(""1 0 6))(end_p(""1 0 32))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 33 44))(end_p(""2 33 45)))))))(position((start_p(""2 33 44))(end_p(""2 33 45)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""2 33 48))(end_p(""2 33 51)))))((value(TyCon(TCon int)()))(position((start_p(""2 33 55))(end_p(""2 33 58)))))))(position((start_p(""2 33 48))(end_p(""2 33 58)))))))(position((start_p(""2 33 43))(end_p(""2 33 59)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 62 69))(end_p(""3 62 70)))))))(position((start_p(""3 62 69))(end_p(""3 62 70)))))((value(TyCon(TCon int)()))(position((start_p(""3 62 73))(end_p(""3 62 76)))))))(position((start_p(""3 62 68))(end_p(""3 62 77)))))((value(Apply((value(Variable((value(Id f))(position((start_p(""3 62 81))(end_p(""3 62 82)))))()))(position((start_p(""3 62 81))(end_p(""3 62 82)))))((value(Variable((value(Id x))(position((start_p(""3 62 84))(end_p(""3 62 85)))))()))(position((start_p(""3 62 83))(end_p(""3 62 86)))))))(position((start_p(""3 62 81))(end_p(""3 62 86))))))))(position((start_p(""3 62 67))(end_p(""3 62 86)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 62 89))(end_p(""3 62 92)))))((value(TyCon(TCon int)()))(position((start_p(""3 62 96))(end_p(""3 62 99)))))))(position((start_p(""3 62 89))(end_p(""3 62 99)))))))(position((start_p(""3 62 66))(end_p(""3 62 100)))))))))))(position((start_p(""1 0 0))(end_p(""3 62 100)))))((value(DefineValue(RecFunctions((((value(Id succ))(position((start_p(""6 119 123))(end_p(""6 119 127)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""5 102 108))(end_p(""5 102 111)))))((value(TyCon(TCon int)()))(position((start_p(""5 102 115))(end_p(""5 102 118)))))))(position((start_p(""5 102 108))(end_p(""5 102 118)))))))(position((start_p(""5 102 108))(end_p(""5 102 118))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""6 119 129))(end_p(""6 119 130)))))))(position((start_p(""6 119 129))(end_p(""6 119 130)))))((value(TyCon(TCon int)()))(position((start_p(""6 119 133))(end_p(""6 119 136)))))))(position((start_p(""6 119 128))(end_p(""6 119 137)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""6 119 142))(end_p(""6 119 143)))))()))(position((start_p(""6 119 142))(end_p(""6 119 143)))))((value(Variable((value(Id x))(position((start_p(""6 119 140))(end_p(""6 119 141)))))()))(position((start_p(""6 119 140))(end_p(""6 119 141)))))))(position((start_p(""6 119 140))(end_p(""6 119 141)))))((value(Literal((value(LInt 1))(position((start_p(""6 119 144))(end_p(""6 119 145)))))))(position((start_p(""6 119 144))(end_p(""6 119 145)))))))(position((start_p(""6 119 140))(end_p(""6 119 145)))))))))))(position((start_p(""5 102 102))(end_p(""6 119 145)))))((value(DefineValue(RecFunctions((((value(Id apply2))(position((start_p(""9 194 198))(end_p(""9 194 204)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 154))(end_p(""8 147 157)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 161))(end_p(""8 147 164)))))((value(TyCon(TCon int)()))(position((start_p(""8 147 168))(end_p(""8 147 171)))))))(position((start_p(""8 147 161))(end_p(""8 147 171)))))))(position((start_p(""8 147 153))(end_p(""8 147 172)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 176))(end_p(""8 147 179)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""8 147 183))(end_p(""8 147 186)))))((value(TyCon(TCon int)()))(position((start_p(""8 147 190))(end_p(""8 147 193)))))))(position((start_p(""8 147 183))(end_p(""8 147 193)))))))(position((start_p(""8 147 176))(end_p(""8 147 193)))))))(position((start_p(""8 147 153))(end_p(""8 147 193)))))))(position((start_p(""8 147 153))(end_p(""8 147 193))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""9 194 206))(end_p(""9 194 207)))))))(position((start_p(""9 194 206))(end_p(""9 194 207)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""9 194 210))(end_p(""9 194 213)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""9 194 217))(end_p(""9 194 220)))))((value(TyCon(TCon int)()))(position((start_p(""9 194 224))(end_p(""9 194 227)))))))(position((start_p(""9 194 217))(end_p(""9 194 227)))))))(position((start_p(""9 194 210))(end_p(""9 194 227)))))))(position((start_p(""9 194 205))(end_p(""9 194 228)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""10 231 238))(end_p(""10 231 239)))))))(position((start_p(""10 231 238))(end_p(""10 231 239)))))((value(TyCon(TCon int)()))(position((start_p(""10 231 242))(end_p(""10 231 245)))))))(position((start_p(""10 231 237))(end_p(""10 231 246)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""11 250 258))(end_p(""11 250 259)))))))(position((start_p(""11 250 258))(end_p(""11 250 259)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 262))(end_p(""11 250 265)))))))(position((start_p(""11 250 257))(end_p(""11 250 266)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""11 250 270))(end_p(""11 250 271)))))()))(position((start_p(""11 250 270))(end_p(""11 250 271)))))((value(Variable((value(Id x))(position((start_p(""11 250 272))(end_p(""11 250 273)))))()))(position((start_p(""11 250 272))(end_p(""11 250 273)))))))(position((start_p(""11 250 270))(end_p(""11 250 273)))))((value(Variable((value(Id y))(position((start_p(""11 250 274))(end_p(""11 250 275)))))()))(position((start_p(""11 250 274))(end_p(""11 250 275)))))))(position((start_p(""11 250 270))(end_p(""11 250 275))))))))(position((start_p(""11 250 256))(end_p(""11 250 275)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 278))(end_p(""11 250 281)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 285))(end_p(""11 250 288)))))))(position((start_p(""11 250 278))(end_p(""11 250 288)))))))(position((start_p(""11 250 255))(end_p(""11 250 289))))))))(position((start_p(""10 231 236))(end_p(""11 250 289)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 292))(end_p(""11 250 295)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""11 250 299))(end_p(""11 250 302)))))((value(TyCon(TCon int)()))(position((start_p(""11 250 306))(end_p(""11 250 309)))))))(position((start_p(""11 250 299))(end_p(""11 250 309)))))))(position((start_p(""11 250 292))(end_p(""11 250 309)))))))(position((start_p(""10 231 235))(end_p(""11 250 310)))))))))))(position((start_p(""8 147 147))(end_p(""11 250 310)))))((value(DefineValue(RecFunctions((((value(Id addmul))(position((start_p(""14 336 341))(end_p(""14 336 347)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""13 312 318))(end_p(""13 312 321)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""13 312 325))(end_p(""13 312 328)))))((value(TyCon(TCon int)()))(position((start_p(""13 312 332))(end_p(""13 312 335)))))))(position((start_p(""13 312 325))(end_p(""13 312 335)))))))(position((start_p(""13 312 318))(end_p(""13 312 335)))))))(position((start_p(""13 312 318))(end_p(""13 312 335))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""14 336 349))(end_p(""14 336 350)))))))(position((start_p(""14 336 349))(end_p(""14 336 350)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 353))(end_p(""14 336 356)))))))(position((start_p(""14 336 348))(end_p(""14 336 357)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""14 336 363))(end_p(""14 336 364)))))))(position((start_p(""14 336 363))(end_p(""14 336 364)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 367))(end_p(""14 336 370)))))))(position((start_p(""14 336 362))(end_p(""14 336 371)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""14 336 381))(end_p(""14 336 382)))))()))(position((start_p(""14 336 381))(end_p(""14 336 382)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""14 336 377))(end_p(""14 336 378)))))()))(position((start_p(""14 336 377))(end_p(""14 336 378)))))((value(Variable((value(Id x))(position((start_p(""14 336 375))(end_p(""14 336 376)))))()))(position((start_p(""14 336 375))(end_p(""14 336 376)))))))(position((start_p(""14 336 375))(end_p(""14 336 376)))))((value(Variable((value(Id y))(position((start_p(""14 336 379))(end_p(""14 336 380)))))()))(position((start_p(""14 336 379))(end_p(""14 336 380)))))))(position((start_p(""14 336 375))(end_p(""14 336 380)))))))(position((start_p(""14 336 375))(end_p(""14 336 380)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""14 336 385))(end_p(""14 336 386)))))()))(position((start_p(""14 336 385))(end_p(""14 336 386)))))((value(Variable((value(Id y))(position((start_p(""14 336 383))(end_p(""14 336 384)))))()))(position((start_p(""14 336 383))(end_p(""14 336 384)))))))(position((start_p(""14 336 383))(end_p(""14 336 384)))))((value(Variable((value(Id x))(position((start_p(""14 336 387))(end_p(""14 336 388)))))()))(position((start_p(""14 336 387))(end_p(""14 336 388)))))))(position((start_p(""14 336 383))(end_p(""14 336 388)))))))(position((start_p(""14 336 375))(end_p(""14 336 388))))))))(position((start_p(""14 336 361))(end_p(""14 336 388)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""14 336 391))(end_p(""14 336 394)))))((value(TyCon(TCon int)()))(position((start_p(""14 336 398))(end_p(""14 336 401)))))))(position((start_p(""14 336 391))(end_p(""14 336 401)))))))(position((start_p(""14 336 360))(end_p(""14 336 402)))))))))))(position((start_p(""13 312 312))(end_p(""14 336 402)))))((value(DefineValue(RecFunctions((((value(Id apply3))(position((start_p(""17 465 469))(end_p(""17 465 475)))))(((value(ForallTy()((value(TyArrow((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 411))(end_p(""16 404 414)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 418))(end_p(""16 404 421)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 425))(end_p(""16 404 428)))))((value(TyCon(TCon int)()))(position((start_p(""16 404 432))(end_p(""16 404 435)))))))(position((start_p(""16 404 425))(end_p(""16 404 435)))))))(position((start_p(""16 404 418))(end_p(""16 404 435)))))))(position((start_p(""16 404 410))(end_p(""16 404 436)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 440))(end_p(""16 404 443)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 447))(end_p(""16 404 450)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""16 404 454))(end_p(""16 404 457)))))((value(TyCon(TCon int)()))(position((start_p(""16 404 461))(end_p(""16 404 464)))))))(position((start_p(""16 404 454))(end_p(""16 404 464)))))))(position((start_p(""16 404 447))(end_p(""16 404 464)))))))(position((start_p(""16 404 440))(end_p(""16 404 464)))))))(position((start_p(""16 404 410))(end_p(""16 404 464)))))))(position((start_p(""16 404 410))(end_p(""16 404 464))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""17 465 477))(end_p(""17 465 478)))))))(position((start_p(""17 465 477))(end_p(""17 465 478)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 481))(end_p(""17 465 484)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 488))(end_p(""17 465 491)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""17 465 495))(end_p(""17 465 498)))))((value(TyCon(TCon int)()))(position((start_p(""17 465 502))(end_p(""17 465 505)))))))(position((start_p(""17 465 495))(end_p(""17 465 505)))))))(position((start_p(""17 465 488))(end_p(""17 465 505)))))))(position((start_p(""17 465 481))(end_p(""17 465 505)))))))(position((start_p(""17 465 476))(end_p(""17 465 506)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""18 509 516))(end_p(""18 509 517)))))))(position((start_p(""18 509 516))(end_p(""18 509 517)))))((value(TyCon(TCon int)()))(position((start_p(""18 509 520))(end_p(""18 509 523)))))))(position((start_p(""18 509 515))(end_p(""18 509 524)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""19 528 537))(end_p(""19 528 538)))))))(position((start_p(""19 528 537))(end_p(""19 528 538)))))((value(TyCon(TCon int)()))(position((start_p(""19 528 541))(end_p(""19 528 544)))))))(position((start_p(""19 528 536))(end_p(""19 528 545)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id z))(position((start_p(""20 549 560))(end_p(""20 549 561)))))))(position((start_p(""20 549 560))(end_p(""20 549 561)))))((value(TyCon(TCon int)()))(position((start_p(""20 549 564))(end_p(""20 549 567)))))))(position((start_p(""20 549 559))(end_p(""20 549 568)))))((value(Apply((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""20 549 572))(end_p(""20 549 573)))))()))(position((start_p(""20 549 572))(end_p(""20 549 573)))))((value(Variable((value(Id x))(position((start_p(""20 549 574))(end_p(""20 549 575)))))()))(position((start_p(""20 549 574))(end_p(""20 549 575)))))))(position((start_p(""20 549 572))(end_p(""20 549 575)))))((value(Variable((value(Id y))(position((start_p(""20 549 576))(end_p(""20 549 577)))))()))(position((start_p(""20 549 576))(end_p(""20 549 577)))))))(position((start_p(""20 549 572))(end_p(""20 549 577)))))((value(Variable((value(Id z))(position((start_p(""20 549 578))(end_p(""20 549 579)))))()))(position((start_p(""20 549 578))(end_p(""20 549 579)))))))(position((start_p(""20 549 572))(end_p(""20 549 579))))))))(position((start_p(""20 549 558))(end_p(""20 549 579)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""20 549 582))(end_p(""20 549 585)))))((value(TyCon(TCon int)()))(position((start_p(""20 549 589))(end_p(""20 549 592)))))))(position((start_p(""20 549 582))(end_p(""20 549 592)))))))(position((start_p(""20 549 557))(end_p(""20 549 593))))))))(position((start_p(""19 528 535))(end_p(""20 549 593)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""21 594 602))(end_p(""21 594 605)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""21 594 609))(end_p(""21 594 612)))))((value(TyCon(TCon int)()))(position((start_p(""21 594 616))(end_p(""21 594 619)))))))(position((start_p(""21 594 609))(end_p(""21 594 619)))))))(position((start_p(""21 594 602))(end_p(""21 594 619)))))))(position((start_p(""19 528 534))(end_p(""21 594 620))))))))(position((start_p(""18 509 514))(end_p(""21 594 620)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 621 627))(end_p(""22 621 630)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 621 634))(end_p(""22 621 637)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""22 621 641))(end_p(""22 621 644)))))((value(TyCon(TCon int)()))(position((start_p(""22 621 648))(end_p(""22 621 651)))))))(position((start_p(""22 621 641))(end_p(""22 621 651)))))))(position((start_p(""22 621 634))(end_p(""22 621 651)))))))(position((start_p(""22 621 627))(end_p(""22 621 651)))))))(position((start_p(""18 509 513))(end_p(""22 621 652)))))))))))(position((start_p(""16 404 404))(end_p(""22 621 652)))))((value(DefineValue(SimpleValue(((value(Id conj))(position((start_p(""24 654 658))(end_p(""24 654 662)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 654 665))(end_p(""24 654 668)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 654 672))(end_p(""24 654 675)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""24 654 679))(end_p(""24 654 682)))))((value(TyCon(TCon int)()))(position((start_p(""24 654 686))(end_p(""24 654 689)))))))(position((start_p(""24 654 679))(end_p(""24 654 689)))))))(position((start_p(""24 654 672))(end_p(""24 654 689)))))))(position((start_p(""24 654 665))(end_p(""24 654 689)))))))(position((start_p(""24 654 665))(end_p(""24 654 689))))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""25 692 699))(end_p(""25 692 700)))))))(position((start_p(""25 692 699))(end_p(""25 692 700)))))((value(TyCon(TCon int)()))(position((start_p(""25 692 703))(end_p(""25 692 706)))))))(position((start_p(""25 692 698))(end_p(""25 692 707)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""26 711 721))(end_p(""26 711 722)))))))(position((start_p(""26 711 721))(end_p(""26 711 722)))))((value(TyCon(TCon int)()))(position((start_p(""26 711 725))(end_p(""26 711 728)))))))(position((start_p(""26 711 720))(end_p(""26 711 729)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id z))(position((start_p(""27 733 745))(end_p(""27 733 746)))))))(position((start_p(""27 733 745))(end_p(""27 733 746)))))((value(TyCon(TCon int)()))(position((start_p(""27 733 749))(end_p(""27 733 752)))))))(position((start_p(""27 733 744))(end_p(""27 733 753)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""27 733 763))(end_p(""27 733 764)))))()))(position((start_p(""27 733 763))(end_p(""27 733 764)))))((value(Apply((value(Apply((value(Variable((value(Id `*`))(position((start_p(""27 733 759))(end_p(""27 733 760)))))()))(position((start_p(""27 733 759))(end_p(""27 733 760)))))((value(Variable((value(Id x))(position((start_p(""27 733 757))(end_p(""27 733 758)))))()))(position((start_p(""27 733 757))(end_p(""27 733 758)))))))(position((start_p(""27 733 757))(end_p(""27 733 758)))))((value(Variable((value(Id y))(position((start_p(""27 733 761))(end_p(""27 733 762)))))()))(position((start_p(""27 733 761))(end_p(""27 733 762)))))))(position((start_p(""27 733 757))(end_p(""27 733 762)))))))(position((start_p(""27 733 757))(end_p(""27 733 762)))))((value(Variable((value(Id z))(position((start_p(""27 733 765))(end_p(""27 733 766)))))()))(position((start_p(""27 733 765))(end_p(""27 733 766)))))))(position((start_p(""27 733 757))(end_p(""27 733 766))))))))(position((start_p(""27 733 743))(end_p(""27 733 766)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""27 733 769))(end_p(""27 733 772)))))((value(TyCon(TCon int)()))(position((start_p(""27 733 776))(end_p(""27 733 779)))))))(position((start_p(""27 733 769))(end_p(""27 733 779)))))))(position((start_p(""27 733 742))(end_p(""27 733 780))))))))(position((start_p(""26 711 719))(end_p(""27 733 780)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""28 781 790))(end_p(""28 781 793)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""28 781 797))(end_p(""28 781 800)))))((value(TyCon(TCon int)()))(position((start_p(""28 781 804))(end_p(""28 781 807)))))))(position((start_p(""28 781 797))(end_p(""28 781 807)))))))(position((start_p(""28 781 790))(end_p(""28 781 807)))))))(position((start_p(""26 711 718))(end_p(""28 781 808))))))))(position((start_p(""25 692 697))(end_p(""28 781 808)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 809 815))(end_p(""29 809 818)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 809 822))(end_p(""29 809 825)))))((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""29 809 829))(end_p(""29 809 832)))))((value(TyCon(TCon int)()))(position((start_p(""29 809 836))(end_p(""29 809 839)))))))(position((start_p(""29 809 829))(end_p(""29 809 839)))))))(position((start_p(""29 809 822))(end_p(""29 809 839)))))))(position((start_p(""29 809 815))(end_p(""29 809 839)))))))(position((start_p(""25 692 696))(end_p(""29 809 840)))))))))(position((start_p(""24 654 654))(end_p(""29 809 840)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""31 842 846))(end_p(""31 842 850)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""31 842 853))(end_p(""31 842 856)))))))(position((start_p(""31 842 853))(end_p(""31 842 856))))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""33 881 903))(end_p(""33 881 904)))))()))(position((start_p(""33 881 903))(end_p(""33 881 904)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""32 859 879))(end_p(""32 859 880)))))()))(position((start_p(""32 859 879))(end_p(""32 859 880)))))((value(Apply((value(Apply((value(Variable((value(Id apply))(position((start_p(""32 859 863))(end_p(""32 859 868)))))()))(position((start_p(""32 859 863))(end_p(""32 859 868)))))((value(Variable((value(Id succ))(position((start_p(""32 859 869))(end_p(""32 859 873)))))()))(position((start_p(""32 859 869))(end_p(""32 859 873)))))))(position((start_p(""32 859 863))(end_p(""32 859 873)))))((value(Literal((value(LInt -1))(position((start_p(""32 859 875))(end_p(""32 859 877)))))))(position((start_p(""32 859 874))(end_p(""32 859 878)))))))(position((start_p(""32 859 863))(end_p(""32 859 878)))))))(position((start_p(""32 859 863))(end_p(""32 859 878)))))((value(Apply((value(Apply((value(Apply((value(Variable((value(Id apply2))(position((start_p(""33 881 885))(end_p(""33 881 891)))))()))(position((start_p(""33 881 885))(end_p(""33 881 891)))))((value(Variable((value(Id addmul))(position((start_p(""33 881 892))(end_p(""33 881 898)))))()))(position((start_p(""33 881 892))(end_p(""33 881 898)))))))(position((start_p(""33 881 885))(end_p(""33 881 898)))))((value(Literal((value(LInt 3))(position((start_p(""33 881 899))(end_p(""33 881 900)))))))(position((start_p(""33 881 899))(end_p(""33 881 900)))))))(position((start_p(""33 881 885))(end_p(""33 881 900)))))((value(Literal((value(LInt 7))(position((start_p(""33 881 901))(end_p(""33 881 902)))))))(position((start_p(""33 881 901))(end_p(""33 881 902)))))))(position((start_p(""33 881 885))(end_p(""33 881 902)))))))(position((start_p(""32 859 863))(end_p(""33 881 902)))))))(position((start_p(""32 859 863))(end_p(""33 881 902)))))((value(Apply((value(Apply((value(Apply((value(Apply((value(Variable((value(Id apply3))(position((start_p(""34 905 909))(end_p(""34 905 915)))))()))(position((start_p(""34 905 909))(end_p(""34 905 915)))))((value(Variable((value(Id conj))(position((start_p(""34 905 916))(end_p(""34 905 920)))))()))(position((start_p(""34 905 916))(end_p(""34 905 920)))))))(position((start_p(""34 905 909))(end_p(""34 905 920)))))((value(Literal((value(LInt 0))(position((start_p(""34 905 921))(end_p(""34 905 922)))))))(position((start_p(""34 905 921))(end_p(""34 905 922)))))))(position((start_p(""34 905 909))(end_p(""34 905 922)))))((value(Literal((value(LInt 1))(position((start_p(""34 905 923))(end_p(""34 905 924)))))))(position((start_p(""34 905 923))(end_p(""34 905 924)))))))(position((start_p(""34 905 909))(end_p(""34 905 924)))))((value(Literal((value(LInt 2))(position((start_p(""34 905 925))(end_p(""34 905 926)))))))(position((start_p(""34 905 925))(end_p(""34 905 926)))))))(position((start_p(""34 905 909))(end_p(""34 905 926)))))))(position((start_p(""32 859 863))(end_p(""34 905 926)))))))))(position((start_p(""31 842 842))(end_p(""34 905 926)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix.human-readable b/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix.human-readable new file mode 100644 index 0000000..eab6cca --- /dev/null +++ b/flap/tests/03-Typing/29-anonymous-nary-functions.good.typing.hopix.human-readable @@ -0,0 +1,37 @@ +fun : (int -> int) -> int -> int + apply (f : int -> int) = + (\(x : int) -> f (x) : int -> int) + +fun : int -> int + succ (x : int) = x + 1 + +fun : (int -> int -> int) -> int -> int -> int + apply2 (f : int -> int -> int) = + (\(x : int) -> + (\(y : int) -> f x y : int -> int) : int -> int -> int) + +fun : int -> int -> int + addmul (x : int) = (\(y : int) -> x * y + y * x : int -> int) + +fun : (int -> int -> int -> int) -> int -> int -> int -> int + apply3 (f : int -> int -> int -> int) = + (\(x : int) -> + (\(y : int) -> + (\(z : int) -> f x y z : int -> int) + : int -> int -> int) + : int -> int -> int -> int) + +let conj : int -> int -> int -> int = + (\(x : int) -> + (\(y : int) -> + (\(z : int) -> x * y * z : int -> int) + : int -> int -> int) + : int -> int -> int -> int) + +let main : int = + apply succ (-1) + + apply2 addmul 3 7 + + apply3 conj 0 1 2 + + + diff --git a/flap/tests/03-Typing/30-anonymous-third-order.bad.expected b/flap/tests/03-Typing/30-anonymous-third-order.bad.expected new file mode 100644 index 0000000..225abb0 --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + `a +Given: + `b diff --git a/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix b/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix new file mode 100644 index 0000000..0d94692 --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fix0))(position((start_p(""2 60 64))(end_p(""2 60 68)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 17))(end_p(""1 0 19)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))(position((start_p(""1 0 16))(end_p(""1 0 26)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 31))(end_p(""1 0 33)))))((value(TyVar(TId `b)))(position((start_p(""1 0 37))(end_p(""1 0 39)))))))(position((start_p(""1 0 30))(end_p(""1 0 40)))))))(position((start_p(""1 0 15))(end_p(""1 0 41)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 45))(end_p(""1 0 47)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""1 0 51))(end_p(""1 0 53)))))((value(TyVar(TId `b)))(position((start_p(""1 0 57))(end_p(""1 0 59)))))))(position((start_p(""1 0 51))(end_p(""1 0 59)))))))(position((start_p(""1 0 45))(end_p(""1 0 59)))))))(position((start_p(""1 0 15))(end_p(""1 0 59)))))))(position((start_p(""1 0 6))(end_p(""1 0 59))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 60 70))(end_p(""2 60 71)))))))(position((start_p(""2 60 70))(end_p(""2 60 71)))))((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 60 75))(end_p(""2 60 77)))))((value(TyVar(TId `b)))(position((start_p(""2 60 81))(end_p(""2 60 83)))))))(position((start_p(""2 60 74))(end_p(""2 60 84)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 60 89))(end_p(""2 60 91)))))((value(TyVar(TId `b)))(position((start_p(""2 60 95))(end_p(""2 60 97)))))))(position((start_p(""2 60 88))(end_p(""2 60 98)))))))(position((start_p(""2 60 74))(end_p(""2 60 98)))))))(position((start_p(""2 60 69))(end_p(""2 60 99)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id a))(position((start_p(""3 102 109))(end_p(""3 102 110)))))))(position((start_p(""3 102 109))(end_p(""3 102 110)))))((value(TyVar(TId `b)))(position((start_p(""3 102 113))(end_p(""3 102 115)))))))(position((start_p(""3 102 108))(end_p(""3 102 116)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id b))(position((start_p(""4 120 129))(end_p(""4 120 130)))))))(position((start_p(""4 120 129))(end_p(""4 120 130)))))((value(TyVar(TId `a)))(position((start_p(""4 120 133))(end_p(""4 120 135)))))))(position((start_p(""4 120 128))(end_p(""4 120 136)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""4 120 140))(end_p(""4 120 141)))))()))(position((start_p(""4 120 140))(end_p(""4 120 141)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 120 145))(end_p(""4 120 146)))))))(position((start_p(""4 120 145))(end_p(""4 120 146)))))((value(TyVar(TId `a)))(position((start_p(""4 120 149))(end_p(""4 120 151)))))))(position((start_p(""4 120 144))(end_p(""4 120 152)))))((value(Variable((value(Id b))(position((start_p(""4 120 156))(end_p(""4 120 157)))))()))(position((start_p(""4 120 156))(end_p(""4 120 157))))))))(position((start_p(""4 120 143))(end_p(""4 120 157)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""4 120 160))(end_p(""4 120 162)))))((value(TyVar(TId `b)))(position((start_p(""4 120 166))(end_p(""4 120 168)))))))(position((start_p(""4 120 160))(end_p(""4 120 168)))))))(position((start_p(""4 120 142))(end_p(""4 120 169)))))))(position((start_p(""4 120 140))(end_p(""4 120 169)))))((value(Variable((value(Id a))(position((start_p(""4 120 170))(end_p(""4 120 171)))))()))(position((start_p(""4 120 170))(end_p(""4 120 171)))))))(position((start_p(""4 120 140))(end_p(""4 120 171))))))))(position((start_p(""4 120 127))(end_p(""4 120 171)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 120 174))(end_p(""4 120 176)))))((value(TyVar(TId `b)))(position((start_p(""4 120 180))(end_p(""4 120 182)))))))(position((start_p(""4 120 174))(end_p(""4 120 182)))))))(position((start_p(""4 120 126))(end_p(""4 120 183))))))))(position((start_p(""3 102 107))(end_p(""4 120 183)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""5 184 190))(end_p(""5 184 192)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""5 184 196))(end_p(""5 184 198)))))((value(TyVar(TId `b)))(position((start_p(""5 184 202))(end_p(""5 184 204)))))))(position((start_p(""5 184 196))(end_p(""5 184 204)))))))(position((start_p(""5 184 190))(end_p(""5 184 204)))))))(position((start_p(""3 102 106))(end_p(""5 184 205)))))))))))(position((start_p(""1 0 0))(end_p(""5 184 205)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix.human-readable b/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix.human-readable new file mode 100644 index 0000000..dfe180a --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] ((`a -> `b) -> (`a -> `b)) -> `a -> `b -> `b + fix0 (f : (`a -> `b) -> (`a -> `b)) = + (\(a : `b) -> + (\(b : `a) -> f (\(x : `a) -> b : `a -> `b) a : `b -> `b) + : `a -> `b -> `b) \ No newline at end of file diff --git a/flap/tests/03-Typing/30-anonymous-third-order.good.expected b/flap/tests/03-Typing/30-anonymous-third-order.good.expected new file mode 100644 index 0000000..1369f1a --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.good.expected @@ -0,0 +1 @@ +fix0 : [`a, `b] ((`a -> `b) -> (`a -> `b)) -> (`a -> (`b -> `b)) diff --git a/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix b/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix new file mode 100644 index 0000000..4747083 --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(RecFunctions((((value(Id fix0))(position((start_p(""2 60 64))(end_p(""2 60 68)))))(((value(ForallTy(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))((value(TyArrow((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 17))(end_p(""1 0 19)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))(position((start_p(""1 0 16))(end_p(""1 0 26)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 31))(end_p(""1 0 33)))))((value(TyVar(TId `b)))(position((start_p(""1 0 37))(end_p(""1 0 39)))))))(position((start_p(""1 0 30))(end_p(""1 0 40)))))))(position((start_p(""1 0 15))(end_p(""1 0 41)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""1 0 45))(end_p(""1 0 47)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""1 0 51))(end_p(""1 0 53)))))((value(TyVar(TId `b)))(position((start_p(""1 0 57))(end_p(""1 0 59)))))))(position((start_p(""1 0 51))(end_p(""1 0 59)))))))(position((start_p(""1 0 45))(end_p(""1 0 59)))))))(position((start_p(""1 0 15))(end_p(""1 0 59)))))))(position((start_p(""1 0 6))(end_p(""1 0 59))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id f))(position((start_p(""2 60 70))(end_p(""2 60 71)))))))(position((start_p(""2 60 70))(end_p(""2 60 71)))))((value(TyArrow((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 60 75))(end_p(""2 60 77)))))((value(TyVar(TId `b)))(position((start_p(""2 60 81))(end_p(""2 60 83)))))))(position((start_p(""2 60 74))(end_p(""2 60 84)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""2 60 89))(end_p(""2 60 91)))))((value(TyVar(TId `b)))(position((start_p(""2 60 95))(end_p(""2 60 97)))))))(position((start_p(""2 60 88))(end_p(""2 60 98)))))))(position((start_p(""2 60 74))(end_p(""2 60 98)))))))(position((start_p(""2 60 69))(end_p(""2 60 99)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id a))(position((start_p(""3 102 109))(end_p(""3 102 110)))))))(position((start_p(""3 102 109))(end_p(""3 102 110)))))((value(TyVar(TId `a)))(position((start_p(""3 102 113))(end_p(""3 102 115)))))))(position((start_p(""3 102 108))(end_p(""3 102 116)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id b))(position((start_p(""4 120 129))(end_p(""4 120 130)))))))(position((start_p(""4 120 129))(end_p(""4 120 130)))))((value(TyVar(TId `b)))(position((start_p(""4 120 133))(end_p(""4 120 135)))))))(position((start_p(""4 120 128))(end_p(""4 120 136)))))((value(Apply((value(Apply((value(Variable((value(Id f))(position((start_p(""4 120 140))(end_p(""4 120 141)))))()))(position((start_p(""4 120 140))(end_p(""4 120 141)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 120 145))(end_p(""4 120 146)))))))(position((start_p(""4 120 145))(end_p(""4 120 146)))))((value(TyVar(TId `a)))(position((start_p(""4 120 149))(end_p(""4 120 151)))))))(position((start_p(""4 120 144))(end_p(""4 120 152)))))((value(Variable((value(Id b))(position((start_p(""4 120 156))(end_p(""4 120 157)))))()))(position((start_p(""4 120 156))(end_p(""4 120 157))))))))(position((start_p(""4 120 143))(end_p(""4 120 157)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""4 120 160))(end_p(""4 120 162)))))((value(TyVar(TId `b)))(position((start_p(""4 120 166))(end_p(""4 120 168)))))))(position((start_p(""4 120 160))(end_p(""4 120 168)))))))(position((start_p(""4 120 142))(end_p(""4 120 169)))))))(position((start_p(""4 120 140))(end_p(""4 120 169)))))((value(Variable((value(Id a))(position((start_p(""4 120 170))(end_p(""4 120 171)))))()))(position((start_p(""4 120 170))(end_p(""4 120 171)))))))(position((start_p(""4 120 140))(end_p(""4 120 171))))))))(position((start_p(""4 120 127))(end_p(""4 120 171)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""4 120 174))(end_p(""4 120 176)))))((value(TyVar(TId `b)))(position((start_p(""4 120 180))(end_p(""4 120 182)))))))(position((start_p(""4 120 174))(end_p(""4 120 182)))))))(position((start_p(""4 120 126))(end_p(""4 120 183))))))))(position((start_p(""3 102 107))(end_p(""4 120 183)))))((value(TyArrow((value(TyVar(TId `a)))(position((start_p(""5 184 190))(end_p(""5 184 192)))))((value(TyArrow((value(TyVar(TId `b)))(position((start_p(""5 184 196))(end_p(""5 184 198)))))((value(TyVar(TId `b)))(position((start_p(""5 184 202))(end_p(""5 184 204)))))))(position((start_p(""5 184 196))(end_p(""5 184 204)))))))(position((start_p(""5 184 190))(end_p(""5 184 204)))))))(position((start_p(""3 102 106))(end_p(""5 184 205)))))))))))(position((start_p(""1 0 0))(end_p(""5 184 205)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix.human-readable b/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix.human-readable new file mode 100644 index 0000000..c4ea185 --- /dev/null +++ b/flap/tests/03-Typing/30-anonymous-third-order.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +fun : [`a, `b] ((`a -> `b) -> (`a -> `b)) -> `a -> `b -> `b + fix0 (f : (`a -> `b) -> (`a -> `b)) = + (\(a : `a) -> + (\(b : `b) -> f (\(x : `a) -> b : `a -> `b) a : `b -> `b) + : `a -> `b -> `b) \ No newline at end of file diff --git a/flap/tests/03-Typing/31-constructor.bad.expected b/flap/tests/03-Typing/31-constructor.bad.expected new file mode 100644 index 0000000..2849f47 --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Unbound constructor `Green'. diff --git a/flap/tests/03-Typing/31-constructor.bad.typing.hopix b/flap/tests/03-Typing/31-constructor.bad.typing.hopix new file mode 100644 index 0000000..483bbf1 --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon color))(position((start_p(""1 0 5))(end_p(""1 0 10)))))()(DefineSumType((((value(KId Red))(position((start_p(""1 0 13))(end_p(""1 0 16)))))())(((value(KId Blue))(position((start_p(""1 0 19))(end_p(""1 0 23)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 23)))))((value(DefineValue(SimpleValue(((value(Id red))(position((start_p(""3 25 29))(end_p(""3 25 32)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""3 25 37))(end_p(""3 25 42)))))))(position((start_p(""3 25 37))(end_p(""3 25 42))))))((value(Tagged((value(KId Red))(position((start_p(""3 25 45))(end_p(""3 25 48)))))(())()))(position((start_p(""3 25 45))(end_p(""3 25 50)))))))))(position((start_p(""3 25 25))(end_p(""3 25 50)))))((value(DefineValue(SimpleValue(((value(Id blue))(position((start_p(""4 51 55))(end_p(""4 51 59)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""4 51 63))(end_p(""4 51 68)))))))(position((start_p(""4 51 63))(end_p(""4 51 68))))))((value(Tagged((value(KId Blue))(position((start_p(""4 51 71))(end_p(""4 51 75)))))(())()))(position((start_p(""4 51 71))(end_p(""4 51 77)))))))))(position((start_p(""4 51 51))(end_p(""4 51 77)))))((value(DefineValue(SimpleValue(((value(Id green))(position((start_p(""5 78 82))(end_p(""5 78 87)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""5 78 90))(end_p(""5 78 95)))))))(position((start_p(""5 78 90))(end_p(""5 78 95))))))((value(Tagged((value(KId Green))(position((start_p(""5 78 98))(end_p(""5 78 103)))))(())()))(position((start_p(""5 78 98))(end_p(""5 78 105)))))))))(position((start_p(""5 78 78))(end_p(""5 78 105)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/31-constructor.bad.typing.hopix.human-readable b/flap/tests/03-Typing/31-constructor.bad.typing.hopix.human-readable new file mode 100644 index 0000000..40754b9 --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type color = Red | Blue + +let red : color = Red<> +let blue : color = Blue<> +let green : color = Green<> \ No newline at end of file diff --git a/flap/tests/03-Typing/31-constructor.good.expected b/flap/tests/03-Typing/31-constructor.good.expected new file mode 100644 index 0000000..1dd4c5c --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.good.expected @@ -0,0 +1,3 @@ +red : color +blue : color +green : color diff --git a/flap/tests/03-Typing/31-constructor.good.typing.hopix b/flap/tests/03-Typing/31-constructor.good.typing.hopix new file mode 100644 index 0000000..1c8529e --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon color))(position((start_p(""1 0 5))(end_p(""1 0 10)))))()(DefineSumType((((value(KId Red))(position((start_p(""1 0 13))(end_p(""1 0 16)))))())(((value(KId Blue))(position((start_p(""1 0 19))(end_p(""1 0 23)))))())(((value(KId Green))(position((start_p(""1 0 26))(end_p(""1 0 31)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 31)))))((value(DefineValue(SimpleValue(((value(Id red))(position((start_p(""3 33 37))(end_p(""3 33 40)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""3 33 45))(end_p(""3 33 50)))))))(position((start_p(""3 33 45))(end_p(""3 33 50))))))((value(Tagged((value(KId Red))(position((start_p(""3 33 53))(end_p(""3 33 56)))))(())()))(position((start_p(""3 33 53))(end_p(""3 33 58)))))))))(position((start_p(""3 33 33))(end_p(""3 33 58)))))((value(DefineValue(SimpleValue(((value(Id blue))(position((start_p(""4 59 63))(end_p(""4 59 67)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""4 59 71))(end_p(""4 59 76)))))))(position((start_p(""4 59 71))(end_p(""4 59 76))))))((value(Tagged((value(KId Blue))(position((start_p(""4 59 79))(end_p(""4 59 83)))))(())()))(position((start_p(""4 59 79))(end_p(""4 59 85)))))))))(position((start_p(""4 59 59))(end_p(""4 59 85)))))((value(DefineValue(SimpleValue(((value(Id green))(position((start_p(""5 86 90))(end_p(""5 86 95)))))(((value(ForallTy()((value(TyCon(TCon color)()))(position((start_p(""5 86 98))(end_p(""5 86 103)))))))(position((start_p(""5 86 98))(end_p(""5 86 103))))))((value(Tagged((value(KId Green))(position((start_p(""5 86 106))(end_p(""5 86 111)))))(())()))(position((start_p(""5 86 106))(end_p(""5 86 113)))))))))(position((start_p(""5 86 86))(end_p(""5 86 113)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/31-constructor.good.typing.hopix.human-readable b/flap/tests/03-Typing/31-constructor.good.typing.hopix.human-readable new file mode 100644 index 0000000..102ce4f --- /dev/null +++ b/flap/tests/03-Typing/31-constructor.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type color = Red | Blue | Green + +let red : color = Red<> +let blue : color = Blue<> +let green : color = Green<> \ No newline at end of file diff --git a/flap/tests/03-Typing/32-constructor-with-data.bad.expected b/flap/tests/03-Typing/32-constructor-with-data.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix b/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix new file mode 100644 index 0000000..0c433dc --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))()(DefineSumType((((value(KId Some))(position((start_p(""1 0 14))(end_p(""1 0 18)))))(((value(TyCon(TCon string)()))(position((start_p(""1 0 20))(end_p(""1 0 26)))))))(((value(KId None))(position((start_p(""1 0 30))(end_p(""1 0 34)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 34)))))((value(DefineValue(SimpleValue(((value(Id none))(position((start_p(""3 36 40))(end_p(""3 36 44)))))(((value(ForallTy()((value(TyCon(TCon option)()))(position((start_p(""3 36 47))(end_p(""3 36 53)))))))(position((start_p(""3 36 47))(end_p(""3 36 53))))))((value(Tagged((value(KId None))(position((start_p(""3 36 56))(end_p(""3 36 60)))))(())()))(position((start_p(""3 36 56))(end_p(""3 36 62)))))))))(position((start_p(""3 36 36))(end_p(""3 36 62)))))((value(DefineValue(SimpleValue(((value(Id some42))(position((start_p(""5 64 68))(end_p(""5 64 74)))))(((value(ForallTy()((value(TyCon(TCon option)()))(position((start_p(""5 64 77))(end_p(""5 64 83)))))))(position((start_p(""5 64 77))(end_p(""5 64 83))))))((value(Tagged((value(KId Some))(position((start_p(""5 64 86))(end_p(""5 64 90)))))(())(((value(Literal((value(LInt 42))(position((start_p(""5 64 94))(end_p(""5 64 96)))))))(position((start_p(""5 64 94))(end_p(""5 64 96))))))))(position((start_p(""5 64 86))(end_p(""5 64 97)))))))))(position((start_p(""5 64 64))(end_p(""5 64 97)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix.human-readable b/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix.human-readable new file mode 100644 index 0000000..b245fc4 --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type option = Some (string) | None + +let none : option = None<> + +let some42 : option = Some<> (42) \ No newline at end of file diff --git a/flap/tests/03-Typing/32-constructor-with-data.good.expected b/flap/tests/03-Typing/32-constructor-with-data.good.expected new file mode 100644 index 0000000..bca2972 --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.good.expected @@ -0,0 +1,2 @@ +none : option +some42 : option diff --git a/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix b/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix new file mode 100644 index 0000000..c0a5684 --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))()(DefineSumType((((value(KId Some))(position((start_p(""1 0 14))(end_p(""1 0 18)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 20))(end_p(""1 0 23)))))))(((value(KId None))(position((start_p(""1 0 27))(end_p(""1 0 31)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 31)))))((value(DefineValue(SimpleValue(((value(Id none))(position((start_p(""3 33 37))(end_p(""3 33 41)))))(((value(ForallTy()((value(TyCon(TCon option)()))(position((start_p(""3 33 44))(end_p(""3 33 50)))))))(position((start_p(""3 33 44))(end_p(""3 33 50))))))((value(Tagged((value(KId None))(position((start_p(""3 33 53))(end_p(""3 33 57)))))(())()))(position((start_p(""3 33 53))(end_p(""3 33 59)))))))))(position((start_p(""3 33 33))(end_p(""3 33 59)))))((value(DefineValue(SimpleValue(((value(Id some42))(position((start_p(""5 61 65))(end_p(""5 61 71)))))(((value(ForallTy()((value(TyCon(TCon option)()))(position((start_p(""5 61 74))(end_p(""5 61 80)))))))(position((start_p(""5 61 74))(end_p(""5 61 80))))))((value(Tagged((value(KId Some))(position((start_p(""5 61 83))(end_p(""5 61 87)))))(())(((value(Literal((value(LInt 42))(position((start_p(""5 61 91))(end_p(""5 61 93)))))))(position((start_p(""5 61 91))(end_p(""5 61 93))))))))(position((start_p(""5 61 83))(end_p(""5 61 94)))))))))(position((start_p(""5 61 61))(end_p(""5 61 94)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix.human-readable b/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix.human-readable new file mode 100644 index 0000000..2ed0c7b --- /dev/null +++ b/flap/tests/03-Typing/32-constructor-with-data.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type option = Some (int) | None + +let none : option = None<> + +let some42 : option = Some<> (42) \ No newline at end of file diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.expected b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix new file mode 100644 index 0000000..673d349 --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon ipair))(position((start_p(""1 0 5))(end_p(""1 0 10)))))()(DefineSumType((((value(KId Pair))(position((start_p(""1 0 13))(end_p(""1 0 17)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 24))(end_p(""1 0 27)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 28)))))((value(DefineValue(SimpleValue(((value(Id a_pair_of_int))(position((start_p(""3 30 34))(end_p(""3 30 47)))))(((value(ForallTy()((value(TyCon(TCon ipair)()))(position((start_p(""3 30 50))(end_p(""3 30 55)))))))(position((start_p(""3 30 50))(end_p(""3 30 55))))))((value(Tagged((value(KId Pair))(position((start_p(""3 30 58))(end_p(""3 30 62)))))(())(((value(Literal((value(LInt 0))(position((start_p(""3 30 65))(end_p(""3 30 66)))))))(position((start_p(""3 30 65))(end_p(""3 30 66)))))((value(Literal((value(LString yo))(position((start_p(""3 30 71))(end_p(""3 30 72)))))))(position((start_p(""3 30 71))(end_p(""3 30 72))))))))(position((start_p(""3 30 58))(end_p(""3 30 73)))))))))(position((start_p(""3 30 30))(end_p(""3 30 73)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix.human-readable b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix.human-readable new file mode 100644 index 0000000..ac7226a --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type ipair = Pair (int, int) + +let a_pair_of_int : ipair = Pair<>(0, "yo") \ No newline at end of file diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.good.expected b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.expected new file mode 100644 index 0000000..72204ed --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.expected @@ -0,0 +1 @@ +a_pair_of_int : ipair diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix new file mode 100644 index 0000000..b430145 --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon ipair))(position((start_p(""1 0 5))(end_p(""1 0 10)))))()(DefineSumType((((value(KId Pair))(position((start_p(""1 0 13))(end_p(""1 0 17)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 24))(end_p(""1 0 27)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 28)))))((value(DefineValue(SimpleValue(((value(Id a_pair_of_int))(position((start_p(""3 30 34))(end_p(""3 30 47)))))(((value(ForallTy()((value(TyCon(TCon ipair)()))(position((start_p(""3 30 50))(end_p(""3 30 55)))))))(position((start_p(""3 30 50))(end_p(""3 30 55))))))((value(Tagged((value(KId Pair))(position((start_p(""3 30 58))(end_p(""3 30 62)))))(())(((value(Literal((value(LInt 0))(position((start_p(""3 30 65))(end_p(""3 30 66)))))))(position((start_p(""3 30 65))(end_p(""3 30 66)))))((value(Literal((value(LInt 1))(position((start_p(""3 30 68))(end_p(""3 30 69)))))))(position((start_p(""3 30 68))(end_p(""3 30 69))))))))(position((start_p(""3 30 58))(end_p(""3 30 70)))))))))(position((start_p(""3 30 30))(end_p(""3 30 70)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix.human-readable b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix.human-readable new file mode 100644 index 0000000..44a13d5 --- /dev/null +++ b/flap/tests/03-Typing/33-constructor-with-multiple-data.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type ipair = Pair (int, int) + +let a_pair_of_int : ipair = Pair<>(0, 1) \ No newline at end of file diff --git a/flap/tests/03-Typing/34-recursive-datatype.bad.expected b/flap/tests/03-Typing/34-recursive-datatype.bad.expected new file mode 100644 index 0000000..5c80770 --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + l +Given: + int diff --git a/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix b/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix new file mode 100644 index 0000000..8aad100 --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon l))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId N))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())(((value(KId C))(position((start_p(""1 0 13))(end_p(""1 0 14)))))(((value(TyCon(TCon l)()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 19))(end_p(""1 0 22)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 23)))))((value(DefineValue(SimpleValue(((value(Id a_list))(position((start_p(""3 25 29))(end_p(""3 25 35)))))(((value(ForallTy()((value(TyCon(TCon l)()))(position((start_p(""3 25 38))(end_p(""3 25 39)))))))(position((start_p(""3 25 38))(end_p(""3 25 39))))))((value(Tagged((value(KId C))(position((start_p(""3 25 42))(end_p(""3 25 43)))))(())(((value(Literal((value(LInt 1))(position((start_p(""3 25 47))(end_p(""3 25 48)))))))(position((start_p(""3 25 47))(end_p(""3 25 48)))))((value(Tagged((value(KId C))(position((start_p(""3 25 50))(end_p(""3 25 51)))))(())(((value(Literal((value(LInt 2))(position((start_p(""3 25 55))(end_p(""3 25 56)))))))(position((start_p(""3 25 55))(end_p(""3 25 56)))))((value(Tagged((value(KId C))(position((start_p(""3 25 58))(end_p(""3 25 59)))))(())(((value(Literal((value(LInt 3))(position((start_p(""3 25 63))(end_p(""3 25 64)))))))(position((start_p(""3 25 63))(end_p(""3 25 64)))))((value(Tagged((value(KId N))(position((start_p(""3 25 66))(end_p(""3 25 67)))))(())()))(position((start_p(""3 25 66))(end_p(""3 25 69))))))))(position((start_p(""3 25 58))(end_p(""3 25 70))))))))(position((start_p(""3 25 50))(end_p(""3 25 71))))))))(position((start_p(""3 25 42))(end_p(""3 25 72)))))))))(position((start_p(""3 25 25))(end_p(""3 25 72)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix.human-readable b/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix.human-readable new file mode 100644 index 0000000..0c7a40c --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type l = N | C (l, int) + +let a_list : l = C<> (1, C<> (2, C<> (3, N<>))) \ No newline at end of file diff --git a/flap/tests/03-Typing/34-recursive-datatype.good.expected b/flap/tests/03-Typing/34-recursive-datatype.good.expected new file mode 100644 index 0000000..e6a7f0a --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.good.expected @@ -0,0 +1 @@ +a_list : l diff --git a/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix b/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix new file mode 100644 index 0000000..b46c169 --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon l))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId N))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())(((value(KId C))(position((start_p(""1 0 13))(end_p(""1 0 14)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 16))(end_p(""1 0 19)))))((value(TyCon(TCon l)()))(position((start_p(""1 0 21))(end_p(""1 0 22)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 23)))))((value(DefineValue(SimpleValue(((value(Id a_list))(position((start_p(""3 25 29))(end_p(""3 25 35)))))(((value(ForallTy()((value(TyCon(TCon l)()))(position((start_p(""3 25 38))(end_p(""3 25 39)))))))(position((start_p(""3 25 38))(end_p(""3 25 39))))))((value(Tagged((value(KId C))(position((start_p(""3 25 42))(end_p(""3 25 43)))))(())(((value(Literal((value(LInt 1))(position((start_p(""3 25 47))(end_p(""3 25 48)))))))(position((start_p(""3 25 47))(end_p(""3 25 48)))))((value(Tagged((value(KId C))(position((start_p(""3 25 50))(end_p(""3 25 51)))))(())(((value(Literal((value(LInt 2))(position((start_p(""3 25 55))(end_p(""3 25 56)))))))(position((start_p(""3 25 55))(end_p(""3 25 56)))))((value(Tagged((value(KId C))(position((start_p(""3 25 58))(end_p(""3 25 59)))))(())(((value(Literal((value(LInt 3))(position((start_p(""3 25 63))(end_p(""3 25 64)))))))(position((start_p(""3 25 63))(end_p(""3 25 64)))))((value(Tagged((value(KId N))(position((start_p(""3 25 66))(end_p(""3 25 67)))))(())()))(position((start_p(""3 25 66))(end_p(""3 25 69))))))))(position((start_p(""3 25 58))(end_p(""3 25 70))))))))(position((start_p(""3 25 50))(end_p(""3 25 71))))))))(position((start_p(""3 25 42))(end_p(""3 25 72)))))))))(position((start_p(""3 25 25))(end_p(""3 25 72)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix.human-readable b/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix.human-readable new file mode 100644 index 0000000..f1751eb --- /dev/null +++ b/flap/tests/03-Typing/34-recursive-datatype.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type l = N | C (int, l) + +let a_list : l = C<> (1, C<> (2, C<> (3, N<>))) \ No newline at end of file diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.bad.expected b/flap/tests/03-Typing/35-recursive-datatype-02.bad.expected new file mode 100644 index 0000000..3e6303b --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + t +Given: + t -> t diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix b/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix new file mode 100644 index 0000000..1b5bb8a --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId N))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())(((value(KId P))(position((start_p(""1 0 13))(end_p(""1 0 14)))))(((value(TyCon(TCon t)()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(TyCon(TCon t)()))(position((start_p(""1 0 19))(end_p(""1 0 20)))))((value(TyCon(TCon t)()))(position((start_p(""1 0 22))(end_p(""1 0 23)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 24)))))((value(DefineValue(SimpleValue(((value(Id leaf))(position((start_p(""3 26 30))(end_p(""3 26 34)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 26 37))(end_p(""3 26 38)))))))(position((start_p(""3 26 37))(end_p(""3 26 38))))))((value(Tagged((value(KId N))(position((start_p(""3 26 41))(end_p(""3 26 42)))))(())()))(position((start_p(""3 26 41))(end_p(""3 26 44)))))))))(position((start_p(""3 26 26))(end_p(""3 26 44)))))((value(DefineValue(SimpleValue(((value(Id a_tree))(position((start_p(""5 46 50))(end_p(""5 46 56)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""5 46 59))(end_p(""5 46 60)))))))(position((start_p(""5 46 59))(end_p(""5 46 60))))))((value(Tagged((value(KId P))(position((start_p(""6 63 65))(end_p(""6 63 66)))))(())(((value(Tagged((value(KId P))(position((start_p(""6 63 70))(end_p(""6 63 71)))))(())(((value(Tagged((value(KId P))(position((start_p(""6 63 75))(end_p(""6 63 76)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 63 80))(end_p(""6 63 84)))))()))(position((start_p(""6 63 80))(end_p(""6 63 84)))))((value(Variable((value(Id leaf))(position((start_p(""6 63 86))(end_p(""6 63 90)))))()))(position((start_p(""6 63 86))(end_p(""6 63 90))))))))(position((start_p(""6 63 75))(end_p(""6 63 91)))))((value(Tagged((value(KId P))(position((start_p(""6 63 93))(end_p(""6 63 94)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 63 97))(end_p(""6 63 101)))))()))(position((start_p(""6 63 97))(end_p(""6 63 101)))))((value(Tagged((value(KId P))(position((start_p(""6 63 103))(end_p(""6 63 104)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 63 107))(end_p(""6 63 111)))))()))(position((start_p(""6 63 107))(end_p(""6 63 111)))))((value(Variable((value(Id leaf))(position((start_p(""6 63 113))(end_p(""6 63 117)))))()))(position((start_p(""6 63 113))(end_p(""6 63 117))))))))(position((start_p(""6 63 103))(end_p(""6 63 118))))))))(position((start_p(""6 63 93))(end_p(""6 63 119))))))))(position((start_p(""6 63 70))(end_p(""6 63 120)))))((value(Variable((value(Id leaf))(position((start_p(""6 63 122))(end_p(""6 63 126)))))()))(position((start_p(""6 63 122))(end_p(""6 63 126))))))))(position((start_p(""6 63 65))(end_p(""6 63 127)))))))))(position((start_p(""5 46 46))(end_p(""6 63 127)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix.human-readable b/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix.human-readable new file mode 100644 index 0000000..65861ef --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.bad.typing.hopix.human-readable @@ -0,0 +1,6 @@ +type t = N | P (t, t, t) + +let leaf : t = N<> + +let a_tree : t = + P<> (P<> (P<> (leaf, leaf), P<>(leaf, P<>(leaf, leaf))), leaf) \ No newline at end of file diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.good.expected b/flap/tests/03-Typing/35-recursive-datatype-02.good.expected new file mode 100644 index 0000000..c24b879 --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.good.expected @@ -0,0 +1,2 @@ +leaf : t +a_tree : t diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix b/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix new file mode 100644 index 0000000..fbfd414 --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId N))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())(((value(KId P))(position((start_p(""1 0 13))(end_p(""1 0 14)))))(((value(TyCon(TCon t)()))(position((start_p(""1 0 16))(end_p(""1 0 17)))))((value(TyCon(TCon t)()))(position((start_p(""1 0 19))(end_p(""1 0 20)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 21)))))((value(DefineValue(SimpleValue(((value(Id leaf))(position((start_p(""3 23 27))(end_p(""3 23 31)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 23 34))(end_p(""3 23 35)))))))(position((start_p(""3 23 34))(end_p(""3 23 35))))))((value(Tagged((value(KId N))(position((start_p(""3 23 38))(end_p(""3 23 39)))))(())()))(position((start_p(""3 23 38))(end_p(""3 23 41)))))))))(position((start_p(""3 23 23))(end_p(""3 23 41)))))((value(DefineValue(SimpleValue(((value(Id a_tree))(position((start_p(""5 43 47))(end_p(""5 43 53)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""5 43 56))(end_p(""5 43 57)))))))(position((start_p(""5 43 56))(end_p(""5 43 57))))))((value(Tagged((value(KId P))(position((start_p(""6 60 62))(end_p(""6 60 63)))))(())(((value(Tagged((value(KId P))(position((start_p(""6 60 67))(end_p(""6 60 68)))))(())(((value(Tagged((value(KId P))(position((start_p(""6 60 72))(end_p(""6 60 73)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 60 77))(end_p(""6 60 81)))))()))(position((start_p(""6 60 77))(end_p(""6 60 81)))))((value(Variable((value(Id leaf))(position((start_p(""6 60 83))(end_p(""6 60 87)))))()))(position((start_p(""6 60 83))(end_p(""6 60 87))))))))(position((start_p(""6 60 72))(end_p(""6 60 88)))))((value(Tagged((value(KId P))(position((start_p(""6 60 90))(end_p(""6 60 91)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 60 94))(end_p(""6 60 98)))))()))(position((start_p(""6 60 94))(end_p(""6 60 98)))))((value(Tagged((value(KId P))(position((start_p(""6 60 100))(end_p(""6 60 101)))))(())(((value(Variable((value(Id leaf))(position((start_p(""6 60 104))(end_p(""6 60 108)))))()))(position((start_p(""6 60 104))(end_p(""6 60 108)))))((value(Variable((value(Id leaf))(position((start_p(""6 60 110))(end_p(""6 60 114)))))()))(position((start_p(""6 60 110))(end_p(""6 60 114))))))))(position((start_p(""6 60 100))(end_p(""6 60 115))))))))(position((start_p(""6 60 90))(end_p(""6 60 116))))))))(position((start_p(""6 60 67))(end_p(""6 60 117)))))((value(Variable((value(Id leaf))(position((start_p(""6 60 119))(end_p(""6 60 123)))))()))(position((start_p(""6 60 119))(end_p(""6 60 123))))))))(position((start_p(""6 60 62))(end_p(""6 60 124)))))))))(position((start_p(""5 43 43))(end_p(""6 60 124)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix.human-readable b/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix.human-readable new file mode 100644 index 0000000..1f4d411 --- /dev/null +++ b/flap/tests/03-Typing/35-recursive-datatype-02.good.typing.hopix.human-readable @@ -0,0 +1,6 @@ +type t = N | P (t, t) + +let leaf : t = N<> + +let a_tree : t = + P<> (P<> (P<> (leaf, leaf), P<>(leaf, P<>(leaf, leaf))), leaf) \ No newline at end of file diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.expected b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.expected new file mode 100644 index 0000000..0a39965 --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + This expression has type s which should be a function type. diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix new file mode 100644 index 0000000..48d28fa --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon s))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId C))(position((start_p(""1 0 9))(end_p(""1 0 10)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 16)))))((value(DefineValue(RecFunctions((((value(Id fromr))(position((start_p(""4 33 39))(end_p(""4 33 44)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 18 24))(end_p(""3 18 27)))))((value(TyCon(TCon s)()))(position((start_p(""3 18 31))(end_p(""3 18 32)))))))(position((start_p(""3 18 24))(end_p(""3 18 32)))))))(position((start_p(""3 18 24))(end_p(""3 18 32))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id n))(position((start_p(""4 33 46))(end_p(""4 33 47)))))))(position((start_p(""4 33 46))(end_p(""4 33 47)))))((value(TyCon(TCon int)()))(position((start_p(""4 33 50))(end_p(""4 33 53)))))))(position((start_p(""4 33 45))(end_p(""4 33 54)))))((value(Tagged((value(KId C))(position((start_p(""4 33 57))(end_p(""4 33 58)))))(())(((value(Variable((value(Id n))(position((start_p(""4 33 62))(end_p(""4 33 63)))))()))(position((start_p(""4 33 62))(end_p(""4 33 63)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id u))(position((start_p(""4 33 68))(end_p(""4 33 69)))))))(position((start_p(""4 33 68))(end_p(""4 33 69)))))((value(TyCon(TCon unit)()))(position((start_p(""4 33 72))(end_p(""4 33 76)))))))(position((start_p(""4 33 67))(end_p(""4 33 77)))))((value(Apply((value(Variable((value(Id fromr))(position((start_p(""4 33 81))(end_p(""4 33 86)))))()))(position((start_p(""4 33 81))(end_p(""4 33 86)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 33 90))(end_p(""4 33 91)))))()))(position((start_p(""4 33 90))(end_p(""4 33 91)))))((value(Variable((value(Id n))(position((start_p(""4 33 88))(end_p(""4 33 89)))))()))(position((start_p(""4 33 88))(end_p(""4 33 89)))))))(position((start_p(""4 33 88))(end_p(""4 33 89)))))((value(Literal((value(LInt 1))(position((start_p(""4 33 92))(end_p(""4 33 93)))))))(position((start_p(""4 33 92))(end_p(""4 33 93)))))))(position((start_p(""4 33 87))(end_p(""4 33 94)))))))(position((start_p(""4 33 81))(end_p(""4 33 94))))))))(position((start_p(""4 33 66))(end_p(""4 33 94)))))((value(TyArrow((value(TyCon(TCon unit)()))(position((start_p(""4 33 97))(end_p(""4 33 101)))))((value(TyCon(TCon s)()))(position((start_p(""4 33 105))(end_p(""4 33 106)))))))(position((start_p(""4 33 97))(end_p(""4 33 106)))))))(position((start_p(""4 33 65))(end_p(""4 33 107))))))))(position((start_p(""4 33 57))(end_p(""4 33 108)))))))))))(position((start_p(""3 18 18))(end_p(""4 33 108)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix.human-readable b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix.human-readable new file mode 100644 index 0000000..cc0a77e --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +type s = C (int) + +fun : int -> s + fromr (n : int) = C<> (n, (\(u : unit) -> fromr (n + 1) : unit -> s)) \ No newline at end of file diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.expected b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.expected new file mode 100644 index 0000000..f28eab1 --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.expected @@ -0,0 +1 @@ +fromr : int -> s diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix new file mode 100644 index 0000000..232e093 --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon s))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId C))(position((start_p(""1 0 9))(end_p(""1 0 10)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15)))))((value(TyArrow((value(TyCon(TCon unit)()))(position((start_p(""1 0 17))(end_p(""1 0 21)))))((value(TyCon(TCon s)()))(position((start_p(""1 0 25))(end_p(""1 0 26)))))))(position((start_p(""1 0 17))(end_p(""1 0 26)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 27)))))((value(DefineValue(RecFunctions((((value(Id fromr))(position((start_p(""4 44 50))(end_p(""4 44 55)))))(((value(ForallTy()((value(TyArrow((value(TyCon(TCon int)()))(position((start_p(""3 29 35))(end_p(""3 29 38)))))((value(TyCon(TCon s)()))(position((start_p(""3 29 42))(end_p(""3 29 43)))))))(position((start_p(""3 29 35))(end_p(""3 29 43)))))))(position((start_p(""3 29 35))(end_p(""3 29 43))))))(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id n))(position((start_p(""4 44 57))(end_p(""4 44 58)))))))(position((start_p(""4 44 57))(end_p(""4 44 58)))))((value(TyCon(TCon int)()))(position((start_p(""4 44 61))(end_p(""4 44 64)))))))(position((start_p(""4 44 56))(end_p(""4 44 65)))))((value(Tagged((value(KId C))(position((start_p(""4 44 68))(end_p(""4 44 69)))))(())(((value(Variable((value(Id n))(position((start_p(""4 44 73))(end_p(""4 44 74)))))()))(position((start_p(""4 44 73))(end_p(""4 44 74)))))((value(TypeAnnotation((value(Fun(FunctionDefinition((value(PTypeAnnotation((value(PVariable((value(Id u))(position((start_p(""4 44 79))(end_p(""4 44 80)))))))(position((start_p(""4 44 79))(end_p(""4 44 80)))))((value(TyCon(TCon unit)()))(position((start_p(""4 44 83))(end_p(""4 44 87)))))))(position((start_p(""4 44 78))(end_p(""4 44 88)))))((value(Apply((value(Variable((value(Id fromr))(position((start_p(""4 44 92))(end_p(""4 44 97)))))()))(position((start_p(""4 44 92))(end_p(""4 44 97)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 44 101))(end_p(""4 44 102)))))()))(position((start_p(""4 44 101))(end_p(""4 44 102)))))((value(Variable((value(Id n))(position((start_p(""4 44 99))(end_p(""4 44 100)))))()))(position((start_p(""4 44 99))(end_p(""4 44 100)))))))(position((start_p(""4 44 99))(end_p(""4 44 100)))))((value(Literal((value(LInt 1))(position((start_p(""4 44 103))(end_p(""4 44 104)))))))(position((start_p(""4 44 103))(end_p(""4 44 104)))))))(position((start_p(""4 44 98))(end_p(""4 44 105)))))))(position((start_p(""4 44 92))(end_p(""4 44 105))))))))(position((start_p(""4 44 77))(end_p(""4 44 105)))))((value(TyArrow((value(TyCon(TCon unit)()))(position((start_p(""4 44 108))(end_p(""4 44 112)))))((value(TyCon(TCon s)()))(position((start_p(""4 44 116))(end_p(""4 44 117)))))))(position((start_p(""4 44 108))(end_p(""4 44 117)))))))(position((start_p(""4 44 76))(end_p(""4 44 118))))))))(position((start_p(""4 44 68))(end_p(""4 44 119)))))))))))(position((start_p(""3 29 29))(end_p(""4 44 119)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix.human-readable b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix.human-readable new file mode 100644 index 0000000..ce538cc --- /dev/null +++ b/flap/tests/03-Typing/36-recurse-datatype-embedding-functions.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +type s = C (int, unit -> s) + +fun : int -> s + fromr (n : int) = C<> (n, (\(u : unit) -> fromr (n + 1) : unit -> s)) \ No newline at end of file diff --git a/flap/tests/03-Typing/37-pattern-matching-01.bad.expected b/flap/tests/03-Typing/37-pattern-matching-01.bad.expected new file mode 100644 index 0000000..7451201 --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Unbound constructor `U'. diff --git a/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix b/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix new file mode 100644 index 0000000..0096b80 --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId T))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 10)))))((value(DefineValue(SimpleValue(((value(Id t))(position((start_p(""3 12 16))(end_p(""3 12 17)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 12 20))(end_p(""3 12 21)))))))(position((start_p(""3 12 20))(end_p(""3 12 21))))))((value(Case((value(Tagged((value(KId T))(position((start_p(""3 12 31))(end_p(""3 12 32)))))(())()))(position((start_p(""3 12 31))(end_p(""3 12 34)))))(((value(Branch((value(PTaggedValue((value(KId U))(position((start_p(""3 12 38))(end_p(""3 12 39)))))(())()))(position((start_p(""3 12 38))(end_p(""3 12 41)))))((value(Tagged((value(KId T))(position((start_p(""3 12 45))(end_p(""3 12 46)))))(())()))(position((start_p(""3 12 45))(end_p(""3 12 48)))))))(position((start_p(""3 12 38))(end_p(""3 12 48))))))))(position((start_p(""3 12 24))(end_p(""3 12 50)))))))))(position((start_p(""3 12 12))(end_p(""3 12 50)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix.human-readable b/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix.human-readable new file mode 100644 index 0000000..b37187b --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type t = T + +let t : t = match (T<>) { U<> -> T<> } diff --git a/flap/tests/03-Typing/37-pattern-matching-01.good.expected b/flap/tests/03-Typing/37-pattern-matching-01.good.expected new file mode 100644 index 0000000..70abf19 --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.good.expected @@ -0,0 +1 @@ +t : t diff --git a/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix b/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix new file mode 100644 index 0000000..100a843 --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId T))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 10)))))((value(DefineValue(SimpleValue(((value(Id t))(position((start_p(""3 12 16))(end_p(""3 12 17)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 12 20))(end_p(""3 12 21)))))))(position((start_p(""3 12 20))(end_p(""3 12 21))))))((value(Case((value(Tagged((value(KId T))(position((start_p(""3 12 31))(end_p(""3 12 32)))))(())()))(position((start_p(""3 12 31))(end_p(""3 12 34)))))(((value(Branch((value(PTaggedValue((value(KId T))(position((start_p(""3 12 38))(end_p(""3 12 39)))))(())()))(position((start_p(""3 12 38))(end_p(""3 12 41)))))((value(Tagged((value(KId T))(position((start_p(""3 12 45))(end_p(""3 12 46)))))(())()))(position((start_p(""3 12 45))(end_p(""3 12 48)))))))(position((start_p(""3 12 38))(end_p(""3 12 48))))))))(position((start_p(""3 12 24))(end_p(""3 12 50)))))))))(position((start_p(""3 12 12))(end_p(""3 12 50)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix.human-readable b/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix.human-readable new file mode 100644 index 0000000..d1ec15f --- /dev/null +++ b/flap/tests/03-Typing/37-pattern-matching-01.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type t = T + +let t : t = match (T<>) { T<> -> T<> } diff --git a/flap/tests/03-Typing/38-pattern-matching-02.bad.expected b/flap/tests/03-Typing/38-pattern-matching-02.bad.expected new file mode 100644 index 0000000..203f784 --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + t +Given: + int diff --git a/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix b/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix new file mode 100644 index 0000000..daa925e --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId T))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 10)))))((value(DefineValue(SimpleValue(((value(Id t))(position((start_p(""3 12 16))(end_p(""3 12 17)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 12 20))(end_p(""3 12 21)))))))(position((start_p(""3 12 20))(end_p(""3 12 21))))))((value(Case((value(Tagged((value(KId T))(position((start_p(""3 12 31))(end_p(""3 12 32)))))(())()))(position((start_p(""3 12 31))(end_p(""3 12 34)))))(((value(Branch((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 12 39))(end_p(""3 12 40)))))))(position((start_p(""3 12 39))(end_p(""3 12 40)))))((value(TyCon(TCon int)()))(position((start_p(""3 12 43))(end_p(""3 12 46)))))))(position((start_p(""3 12 38))(end_p(""3 12 47)))))((value(Variable((value(Id x))(position((start_p(""3 12 51))(end_p(""3 12 52)))))()))(position((start_p(""3 12 51))(end_p(""3 12 52)))))))(position((start_p(""3 12 38))(end_p(""3 12 52))))))))(position((start_p(""3 12 24))(end_p(""3 12 54)))))))))(position((start_p(""3 12 12))(end_p(""3 12 54)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix.human-readable b/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix.human-readable new file mode 100644 index 0000000..dff2202 --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type t = T + +let t : t = match (T<>) { (x : int) -> x } diff --git a/flap/tests/03-Typing/38-pattern-matching-02.good.expected b/flap/tests/03-Typing/38-pattern-matching-02.good.expected new file mode 100644 index 0000000..70abf19 --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.good.expected @@ -0,0 +1 @@ +t : t diff --git a/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix b/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix new file mode 100644 index 0000000..b3eea14 --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon t))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId T))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 10)))))((value(DefineValue(SimpleValue(((value(Id t))(position((start_p(""3 12 16))(end_p(""3 12 17)))))(((value(ForallTy()((value(TyCon(TCon t)()))(position((start_p(""3 12 20))(end_p(""3 12 21)))))))(position((start_p(""3 12 20))(end_p(""3 12 21))))))((value(Case((value(Tagged((value(KId T))(position((start_p(""3 12 31))(end_p(""3 12 32)))))(())()))(position((start_p(""3 12 31))(end_p(""3 12 34)))))(((value(Branch((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 12 39))(end_p(""3 12 40)))))))(position((start_p(""3 12 39))(end_p(""3 12 40)))))((value(TyCon(TCon t)()))(position((start_p(""3 12 43))(end_p(""3 12 44)))))))(position((start_p(""3 12 38))(end_p(""3 12 45)))))((value(Variable((value(Id x))(position((start_p(""3 12 49))(end_p(""3 12 50)))))()))(position((start_p(""3 12 49))(end_p(""3 12 50)))))))(position((start_p(""3 12 38))(end_p(""3 12 50))))))))(position((start_p(""3 12 24))(end_p(""3 12 52)))))))))(position((start_p(""3 12 12))(end_p(""3 12 52)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix.human-readable b/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix.human-readable new file mode 100644 index 0000000..7aaab55 --- /dev/null +++ b/flap/tests/03-Typing/38-pattern-matching-02.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type t = T + +let t : t = match (T<>) { (x : t) -> x } diff --git a/flap/tests/03-Typing/39-pattern-matching-03.bad.expected b/flap/tests/03-Typing/39-pattern-matching-03.bad.expected new file mode 100644 index 0000000..16b7c5f --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + Unbound constructor `B'. diff --git a/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix b/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix new file mode 100644 index 0000000..dcd5722 --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon c))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId A))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 10)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 12 16))(end_p(""3 12 20)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 12 23))(end_p(""3 12 26)))))))(position((start_p(""3 12 23))(end_p(""3 12 26))))))((value(Case((value(Tagged((value(KId A))(position((start_p(""3 12 36))(end_p(""3 12 37)))))(())()))(position((start_p(""3 12 36))(end_p(""3 12 39)))))(((value(Branch((value(PTaggedValue((value(KId A))(position((start_p(""3 12 43))(end_p(""3 12 44)))))(())()))(position((start_p(""3 12 43))(end_p(""3 12 46)))))((value(Literal((value(LInt 0))(position((start_p(""3 12 50))(end_p(""3 12 51)))))))(position((start_p(""3 12 50))(end_p(""3 12 51)))))))(position((start_p(""3 12 43))(end_p(""3 12 51)))))((value(Branch((value(PTaggedValue((value(KId B))(position((start_p(""3 12 54))(end_p(""3 12 55)))))(())()))(position((start_p(""3 12 54))(end_p(""3 12 57)))))((value(Literal((value(LInt 1))(position((start_p(""3 12 61))(end_p(""3 12 62)))))))(position((start_p(""3 12 61))(end_p(""3 12 62)))))))(position((start_p(""3 12 54))(end_p(""3 12 62))))))))(position((start_p(""3 12 29))(end_p(""3 12 64)))))))))(position((start_p(""3 12 12))(end_p(""3 12 64)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix.human-readable b/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix.human-readable new file mode 100644 index 0000000..733098b --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type c = A + +let main : int = match (A<>) { A<> -> 0 | B<> -> 1 } \ No newline at end of file diff --git a/flap/tests/03-Typing/39-pattern-matching-03.good.expected b/flap/tests/03-Typing/39-pattern-matching-03.good.expected new file mode 100644 index 0000000..4b66f6f --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.good.expected @@ -0,0 +1 @@ +main : int diff --git a/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix b/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix new file mode 100644 index 0000000..614e144 --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon c))(position((start_p(""1 0 5))(end_p(""1 0 6)))))()(DefineSumType((((value(KId A))(position((start_p(""1 0 9))(end_p(""1 0 10)))))())(((value(KId B))(position((start_p(""1 0 13))(end_p(""1 0 14)))))())))))(position((start_p(""1 0 0))(end_p(""1 0 14)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 16 20))(end_p(""3 16 24)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 16 27))(end_p(""3 16 30)))))))(position((start_p(""3 16 27))(end_p(""3 16 30))))))((value(Case((value(Tagged((value(KId A))(position((start_p(""3 16 40))(end_p(""3 16 41)))))(())()))(position((start_p(""3 16 40))(end_p(""3 16 43)))))(((value(Branch((value(PTaggedValue((value(KId A))(position((start_p(""3 16 47))(end_p(""3 16 48)))))(())()))(position((start_p(""3 16 47))(end_p(""3 16 50)))))((value(Literal((value(LInt 0))(position((start_p(""3 16 54))(end_p(""3 16 55)))))))(position((start_p(""3 16 54))(end_p(""3 16 55)))))))(position((start_p(""3 16 47))(end_p(""3 16 55)))))((value(Branch((value(PTaggedValue((value(KId B))(position((start_p(""3 16 58))(end_p(""3 16 59)))))(())()))(position((start_p(""3 16 58))(end_p(""3 16 61)))))((value(Literal((value(LInt 1))(position((start_p(""3 16 65))(end_p(""3 16 66)))))))(position((start_p(""3 16 65))(end_p(""3 16 66)))))))(position((start_p(""3 16 58))(end_p(""3 16 66))))))))(position((start_p(""3 16 33))(end_p(""3 16 68)))))))))(position((start_p(""3 16 16))(end_p(""3 16 68)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix.human-readable b/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix.human-readable new file mode 100644 index 0000000..04987af --- /dev/null +++ b/flap/tests/03-Typing/39-pattern-matching-03.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type c = A | B + +let main : int = match (A<>) { A<> -> 0 | B<> -> 1 } \ No newline at end of file diff --git a/flap/tests/03-Typing/40-pattern-matching-04.bad.expected b/flap/tests/03-Typing/40-pattern-matching-04.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix b/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix new file mode 100644 index 0000000..e728da6 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))()(DefineSumType((((value(KId None))(position((start_p(""1 0 14))(end_p(""1 0 18)))))())(((value(KId Some))(position((start_p(""1 0 21))(end_p(""1 0 25)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 27))(end_p(""1 0 30)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 31)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 33 37))(end_p(""3 33 38)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 33 41))(end_p(""3 33 44)))))))(position((start_p(""3 33 41))(end_p(""3 33 44))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 33 54))(end_p(""3 33 58)))))(())(((value(Literal((value(LInt 42))(position((start_p(""3 33 61))(end_p(""3 33 63)))))))(position((start_p(""3 33 61))(end_p(""3 33 63))))))))(position((start_p(""3 33 54))(end_p(""3 33 64)))))(((value(Branch((value(PTaggedValue((value(KId Some))(position((start_p(""3 33 68))(end_p(""3 33 72)))))(())(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 33 76))(end_p(""3 33 77)))))))(position((start_p(""3 33 76))(end_p(""3 33 77)))))((value(TyCon(TCon string)()))(position((start_p(""3 33 80))(end_p(""3 33 86)))))))(position((start_p(""3 33 75))(end_p(""3 33 87))))))))(position((start_p(""3 33 68))(end_p(""3 33 88)))))((value(Variable((value(Id x))(position((start_p(""3 33 92))(end_p(""3 33 93)))))()))(position((start_p(""3 33 92))(end_p(""3 33 93)))))))(position((start_p(""3 33 68))(end_p(""3 33 93)))))((value(Branch((value(PTaggedValue((value(KId None))(position((start_p(""3 33 96))(end_p(""3 33 100)))))(())()))(position((start_p(""3 33 96))(end_p(""3 33 102)))))((value(Literal((value(LInt 0))(position((start_p(""3 33 106))(end_p(""3 33 107)))))))(position((start_p(""3 33 106))(end_p(""3 33 107)))))))(position((start_p(""3 33 96))(end_p(""3 33 107))))))))(position((start_p(""3 33 47))(end_p(""3 33 109)))))))))(position((start_p(""3 33 33))(end_p(""3 33 109)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix.human-readable b/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix.human-readable new file mode 100644 index 0000000..78ffc24 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option = None | Some (int) + +let x : int = match (Some<>(42)) { Some<>((x : string)) -> x | None<> -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/40-pattern-matching-04.good.expected b/flap/tests/03-Typing/40-pattern-matching-04.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix b/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix new file mode 100644 index 0000000..6666bf1 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))()(DefineSumType((((value(KId None))(position((start_p(""1 0 14))(end_p(""1 0 18)))))())(((value(KId Some))(position((start_p(""1 0 21))(end_p(""1 0 25)))))(((value(TyCon(TCon int)()))(position((start_p(""1 0 27))(end_p(""1 0 30)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 31)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 33 37))(end_p(""3 33 38)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 33 41))(end_p(""3 33 44)))))))(position((start_p(""3 33 41))(end_p(""3 33 44))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 33 54))(end_p(""3 33 58)))))(())(((value(Literal((value(LInt 42))(position((start_p(""3 33 61))(end_p(""3 33 63)))))))(position((start_p(""3 33 61))(end_p(""3 33 63))))))))(position((start_p(""3 33 54))(end_p(""3 33 64)))))(((value(Branch((value(PTaggedValue((value(KId Some))(position((start_p(""3 33 68))(end_p(""3 33 72)))))(())(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 33 76))(end_p(""3 33 77)))))))(position((start_p(""3 33 76))(end_p(""3 33 77)))))((value(TyCon(TCon int)()))(position((start_p(""3 33 80))(end_p(""3 33 83)))))))(position((start_p(""3 33 75))(end_p(""3 33 84))))))))(position((start_p(""3 33 68))(end_p(""3 33 85)))))((value(Variable((value(Id x))(position((start_p(""3 33 89))(end_p(""3 33 90)))))()))(position((start_p(""3 33 89))(end_p(""3 33 90)))))))(position((start_p(""3 33 68))(end_p(""3 33 90)))))((value(Branch((value(PTaggedValue((value(KId None))(position((start_p(""3 33 93))(end_p(""3 33 97)))))(())()))(position((start_p(""3 33 93))(end_p(""3 33 99)))))((value(Literal((value(LInt 0))(position((start_p(""3 33 103))(end_p(""3 33 104)))))))(position((start_p(""3 33 103))(end_p(""3 33 104)))))))(position((start_p(""3 33 93))(end_p(""3 33 104))))))))(position((start_p(""3 33 47))(end_p(""3 33 106)))))))))(position((start_p(""3 33 33))(end_p(""3 33 106)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix.human-readable b/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix.human-readable new file mode 100644 index 0000000..c20b233 --- /dev/null +++ b/flap/tests/03-Typing/40-pattern-matching-04.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option = None | Some (int) + +let x : int = match (Some<>(42)) { Some<>((x : int)) -> x | None<> -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/41-pattern-matching-05.bad.expected b/flap/tests/03-Typing/41-pattern-matching-05.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix b/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix new file mode 100644 index 0000000..6b8437a --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))(((value(TId `a))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId None))(position((start_p(""1 0 18))(end_p(""1 0 22)))))())(((value(KId Some))(position((start_p(""1 0 25))(end_p(""1 0 29)))))(((value(TyCon(TCon string)()))(position((start_p(""1 0 31))(end_p(""1 0 37)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 38)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 40 44))(end_p(""3 40 45)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 40 48))(end_p(""3 40 51)))))))(position((start_p(""3 40 48))(end_p(""3 40 51))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 40 61))(end_p(""3 40 65)))))((((value(TyCon(TCon int)()))(position((start_p(""3 40 66))(end_p(""3 40 69)))))))(((value(Literal((value(LInt 42))(position((start_p(""3 40 71))(end_p(""3 40 73)))))))(position((start_p(""3 40 71))(end_p(""3 40 73))))))))(position((start_p(""3 40 61))(end_p(""3 40 74)))))(((value(Branch((value(PTaggedValue((value(KId Some))(position((start_p(""3 40 78))(end_p(""3 40 82)))))((((value(TyCon(TCon int)()))(position((start_p(""3 40 83))(end_p(""3 40 86)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 40 89))(end_p(""3 40 90)))))))(position((start_p(""3 40 89))(end_p(""3 40 90)))))((value(TyCon(TCon int)()))(position((start_p(""3 40 93))(end_p(""3 40 96)))))))(position((start_p(""3 40 88))(end_p(""3 40 97))))))))(position((start_p(""3 40 78))(end_p(""3 40 98)))))((value(Variable((value(Id x))(position((start_p(""3 40 102))(end_p(""3 40 103)))))()))(position((start_p(""3 40 102))(end_p(""3 40 103)))))))(position((start_p(""3 40 78))(end_p(""3 40 103)))))((value(Branch((value(PTaggedValue((value(KId None))(position((start_p(""3 40 106))(end_p(""3 40 110)))))((((value(TyCon(TCon int)()))(position((start_p(""3 40 111))(end_p(""3 40 114)))))))()))(position((start_p(""3 40 106))(end_p(""3 40 115)))))((value(Literal((value(LInt 0))(position((start_p(""3 40 119))(end_p(""3 40 120)))))))(position((start_p(""3 40 119))(end_p(""3 40 120)))))))(position((start_p(""3 40 106))(end_p(""3 40 120))))))))(position((start_p(""3 40 54))(end_p(""3 40 122)))))))))(position((start_p(""3 40 40))(end_p(""3 40 122)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix.human-readable b/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix.human-readable new file mode 100644 index 0000000..8016496 --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option<`a> = None | Some (string) + +let x : int = match (Some(42)) { Some((x : int)) -> x | None -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/41-pattern-matching-05.good.expected b/flap/tests/03-Typing/41-pattern-matching-05.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix b/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix new file mode 100644 index 0000000..d0592db --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))(((value(TId `a))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId None))(position((start_p(""1 0 18))(end_p(""1 0 22)))))())(((value(KId Some))(position((start_p(""1 0 25))(end_p(""1 0 29)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 31))(end_p(""1 0 33)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 34)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 36 40))(end_p(""3 36 41)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 36 44))(end_p(""3 36 47)))))))(position((start_p(""3 36 44))(end_p(""3 36 47))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 36 57))(end_p(""3 36 61)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 62))(end_p(""3 36 65)))))))(((value(Literal((value(LInt 42))(position((start_p(""3 36 67))(end_p(""3 36 69)))))))(position((start_p(""3 36 67))(end_p(""3 36 69))))))))(position((start_p(""3 36 57))(end_p(""3 36 70)))))(((value(Branch((value(PTaggedValue((value(KId Some))(position((start_p(""3 36 74))(end_p(""3 36 78)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 79))(end_p(""3 36 82)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""3 36 85))(end_p(""3 36 86)))))))(position((start_p(""3 36 85))(end_p(""3 36 86)))))((value(TyCon(TCon int)()))(position((start_p(""3 36 89))(end_p(""3 36 92)))))))(position((start_p(""3 36 84))(end_p(""3 36 93))))))))(position((start_p(""3 36 74))(end_p(""3 36 94)))))((value(Variable((value(Id x))(position((start_p(""3 36 98))(end_p(""3 36 99)))))()))(position((start_p(""3 36 98))(end_p(""3 36 99)))))))(position((start_p(""3 36 74))(end_p(""3 36 99)))))((value(Branch((value(PTaggedValue((value(KId None))(position((start_p(""3 36 102))(end_p(""3 36 106)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 107))(end_p(""3 36 110)))))))()))(position((start_p(""3 36 102))(end_p(""3 36 111)))))((value(Literal((value(LInt 0))(position((start_p(""3 36 115))(end_p(""3 36 116)))))))(position((start_p(""3 36 115))(end_p(""3 36 116)))))))(position((start_p(""3 36 102))(end_p(""3 36 116))))))))(position((start_p(""3 36 50))(end_p(""3 36 118)))))))))(position((start_p(""3 36 36))(end_p(""3 36 118)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix.human-readable b/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix.human-readable new file mode 100644 index 0000000..8798390 --- /dev/null +++ b/flap/tests/03-Typing/41-pattern-matching-05.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option<`a> = None | Some (`a) + +let x : int = match (Some(42)) { Some((x : int)) -> x | None -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/42-pattern-matching-06.bad.expected b/flap/tests/03-Typing/42-pattern-matching-06.bad.expected new file mode 100644 index 0000000..ea67129 --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + option +Given: + option diff --git a/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix b/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix new file mode 100644 index 0000000..0e9a42e --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))(((value(TId `a))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId None))(position((start_p(""1 0 18))(end_p(""1 0 22)))))())(((value(KId Some))(position((start_p(""1 0 25))(end_p(""1 0 29)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 31))(end_p(""1 0 33)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 34)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 36 40))(end_p(""3 36 41)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 36 44))(end_p(""3 36 47)))))))(position((start_p(""3 36 44))(end_p(""3 36 47))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 36 57))(end_p(""3 36 61)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 62))(end_p(""3 36 65)))))))(((value(Literal((value(LInt 42))(position((start_p(""3 36 67))(end_p(""3 36 69)))))))(position((start_p(""3 36 67))(end_p(""3 36 69))))))))(position((start_p(""3 36 57))(end_p(""3 36 70)))))(((value(Branch((value(POr(((value(PTaggedValue((value(KId Some))(position((start_p(""3 36 74))(end_p(""3 36 78)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 79))(end_p(""3 36 82)))))))(((value(PTypeAnnotation((value PWildcard)(position((start_p(""3 36 85))(end_p(""3 36 86)))))((value(TyCon(TCon int)()))(position((start_p(""3 36 89))(end_p(""3 36 92)))))))(position((start_p(""3 36 84))(end_p(""3 36 93))))))))(position((start_p(""3 36 74))(end_p(""3 36 94)))))((value(PTaggedValue((value(KId None))(position((start_p(""3 36 97))(end_p(""3 36 101)))))((((value(TyCon(TCon string)()))(position((start_p(""3 36 102))(end_p(""3 36 108)))))))()))(position((start_p(""3 36 97))(end_p(""3 36 109))))))))(position((start_p(""3 36 74))(end_p(""3 36 109)))))((value(Literal((value(LInt 0))(position((start_p(""3 36 113))(end_p(""3 36 114)))))))(position((start_p(""3 36 113))(end_p(""3 36 114)))))))(position((start_p(""3 36 74))(end_p(""3 36 114))))))))(position((start_p(""3 36 50))(end_p(""3 36 116)))))))))(position((start_p(""3 36 36))(end_p(""3 36 116)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix.human-readable b/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix.human-readable new file mode 100644 index 0000000..c05885d --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.bad.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option<`a> = None | Some (`a) + +let x : int = match (Some(42)) { Some((_ : int)) | None -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/42-pattern-matching-06.good.expected b/flap/tests/03-Typing/42-pattern-matching-06.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix b/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix new file mode 100644 index 0000000..ecb77bf --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon option))(position((start_p(""1 0 5))(end_p(""1 0 11)))))(((value(TId `a))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId None))(position((start_p(""1 0 18))(end_p(""1 0 22)))))())(((value(KId Some))(position((start_p(""1 0 25))(end_p(""1 0 29)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 31))(end_p(""1 0 33)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 34)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 36 40))(end_p(""3 36 41)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 36 44))(end_p(""3 36 47)))))))(position((start_p(""3 36 44))(end_p(""3 36 47))))))((value(Case((value(Tagged((value(KId Some))(position((start_p(""3 36 57))(end_p(""3 36 61)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 62))(end_p(""3 36 65)))))))(((value(Literal((value(LInt 42))(position((start_p(""3 36 67))(end_p(""3 36 69)))))))(position((start_p(""3 36 67))(end_p(""3 36 69))))))))(position((start_p(""3 36 57))(end_p(""3 36 70)))))(((value(Branch((value(POr(((value(PTaggedValue((value(KId Some))(position((start_p(""3 36 74))(end_p(""3 36 78)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 79))(end_p(""3 36 82)))))))(((value(PTypeAnnotation((value PWildcard)(position((start_p(""3 36 85))(end_p(""3 36 86)))))((value(TyCon(TCon int)()))(position((start_p(""3 36 89))(end_p(""3 36 92)))))))(position((start_p(""3 36 84))(end_p(""3 36 93))))))))(position((start_p(""3 36 74))(end_p(""3 36 94)))))((value(PTaggedValue((value(KId None))(position((start_p(""3 36 97))(end_p(""3 36 101)))))((((value(TyCon(TCon int)()))(position((start_p(""3 36 102))(end_p(""3 36 105)))))))()))(position((start_p(""3 36 97))(end_p(""3 36 106))))))))(position((start_p(""3 36 74))(end_p(""3 36 106)))))((value(Literal((value(LInt 0))(position((start_p(""3 36 110))(end_p(""3 36 111)))))))(position((start_p(""3 36 110))(end_p(""3 36 111)))))))(position((start_p(""3 36 74))(end_p(""3 36 111))))))))(position((start_p(""3 36 50))(end_p(""3 36 113)))))))))(position((start_p(""3 36 36))(end_p(""3 36 113)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix.human-readable b/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix.human-readable new file mode 100644 index 0000000..aac9360 --- /dev/null +++ b/flap/tests/03-Typing/42-pattern-matching-06.good.typing.hopix.human-readable @@ -0,0 +1,3 @@ +type option<`a> = None | Some (`a) + +let x : int = match (Some(42)) { Some((_ : int)) | None -> 0 } diff --git a/flap/tests/03-Typing/43-pattern-matching-07.bad.expected b/flap/tests/03-Typing/43-pattern-matching-07.bad.expected new file mode 100644 index 0000000..c42b606 --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + or +Given: + or diff --git a/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix b/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix new file mode 100644 index 0000000..a0d5091 --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon or))(position((start_p(""1 0 5))(end_p(""1 0 7)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10)))))((value(TId `b))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId Left))(position((start_p(""1 0 18))(end_p(""1 0 22)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))(((value(KId Right))(position((start_p(""1 0 29))(end_p(""1 0 34)))))(((value(TyVar(TId `b)))(position((start_p(""1 0 35))(end_p(""1 0 37)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 38)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 40 44))(end_p(""3 40 45)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 40 48))(end_p(""3 40 51)))))))(position((start_p(""3 40 48))(end_p(""3 40 51))))))((value(Case((value(Tagged((value(KId Left))(position((start_p(""3 40 61))(end_p(""3 40 65)))))((((value(TyCon(TCon int)()))(position((start_p(""3 40 66))(end_p(""3 40 69)))))((value(TyCon(TCon int)()))(position((start_p(""3 40 71))(end_p(""3 40 74)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 40 76))(end_p(""3 40 78)))))))(position((start_p(""3 40 76))(end_p(""3 40 78))))))))(position((start_p(""3 40 61))(end_p(""3 40 79)))))(((value(Branch((value(POr(((value(PTaggedValue((value(KId Left))(position((start_p(""4 83 85))(end_p(""4 83 89)))))((((value(TyCon(TCon int)()))(position((start_p(""4 83 90))(end_p(""4 83 93)))))((value(TyCon(TCon string)()))(position((start_p(""4 83 95))(end_p(""4 83 101)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 83 104))(end_p(""4 83 105)))))))(position((start_p(""4 83 104))(end_p(""4 83 105)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 108))(end_p(""4 83 111)))))))(position((start_p(""4 83 103))(end_p(""4 83 112))))))))(position((start_p(""4 83 85))(end_p(""4 83 113)))))((value(PTaggedValue((value(KId Right))(position((start_p(""4 83 116))(end_p(""4 83 121)))))((((value(TyCon(TCon int)()))(position((start_p(""4 83 122))(end_p(""4 83 125)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 127))(end_p(""4 83 130)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 83 133))(end_p(""4 83 134)))))))(position((start_p(""4 83 133))(end_p(""4 83 134)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 137))(end_p(""4 83 140)))))))(position((start_p(""4 83 132))(end_p(""4 83 141))))))))(position((start_p(""4 83 116))(end_p(""4 83 142))))))))(position((start_p(""4 83 85))(end_p(""4 83 142)))))((value(Variable((value(Id x))(position((start_p(""4 83 146))(end_p(""4 83 147)))))()))(position((start_p(""4 83 146))(end_p(""4 83 147)))))))(position((start_p(""4 83 85))(end_p(""4 83 147))))))))(position((start_p(""3 40 54))(end_p(""5 148 149)))))))))(position((start_p(""3 40 40))(end_p(""5 148 149)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix.human-readable b/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix.human-readable new file mode 100644 index 0000000..3c77efd --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type or<`a, `b> = Left(`a) | Right(`b) + +let x : int = match (Left(22)) { + Left((x : int)) | Right((x : int)) -> x +} \ No newline at end of file diff --git a/flap/tests/03-Typing/43-pattern-matching-07.good.expected b/flap/tests/03-Typing/43-pattern-matching-07.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix b/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix new file mode 100644 index 0000000..1f663cd --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon or))(position((start_p(""1 0 5))(end_p(""1 0 7)))))(((value(TId `a))(position((start_p(""1 0 8))(end_p(""1 0 10)))))((value(TId `b))(position((start_p(""1 0 12))(end_p(""1 0 14))))))(DefineSumType((((value(KId Left))(position((start_p(""1 0 18))(end_p(""1 0 22)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))(((value(KId Right))(position((start_p(""1 0 29))(end_p(""1 0 34)))))(((value(TyVar(TId `b)))(position((start_p(""1 0 35))(end_p(""1 0 37)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 38)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 40 44))(end_p(""3 40 45)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 40 48))(end_p(""3 40 51)))))))(position((start_p(""3 40 48))(end_p(""3 40 51))))))((value(Case((value(Tagged((value(KId Left))(position((start_p(""3 40 61))(end_p(""3 40 65)))))((((value(TyCon(TCon int)()))(position((start_p(""3 40 66))(end_p(""3 40 69)))))((value(TyCon(TCon int)()))(position((start_p(""3 40 71))(end_p(""3 40 74)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 40 76))(end_p(""3 40 78)))))))(position((start_p(""3 40 76))(end_p(""3 40 78))))))))(position((start_p(""3 40 61))(end_p(""3 40 79)))))(((value(Branch((value(POr(((value(PTaggedValue((value(KId Left))(position((start_p(""4 83 85))(end_p(""4 83 89)))))((((value(TyCon(TCon int)()))(position((start_p(""4 83 90))(end_p(""4 83 93)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 95))(end_p(""4 83 98)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 83 101))(end_p(""4 83 102)))))))(position((start_p(""4 83 101))(end_p(""4 83 102)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 105))(end_p(""4 83 108)))))))(position((start_p(""4 83 100))(end_p(""4 83 109))))))))(position((start_p(""4 83 85))(end_p(""4 83 110)))))((value(PTaggedValue((value(KId Right))(position((start_p(""4 83 113))(end_p(""4 83 118)))))((((value(TyCon(TCon int)()))(position((start_p(""4 83 119))(end_p(""4 83 122)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 124))(end_p(""4 83 127)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 83 130))(end_p(""4 83 131)))))))(position((start_p(""4 83 130))(end_p(""4 83 131)))))((value(TyCon(TCon int)()))(position((start_p(""4 83 134))(end_p(""4 83 137)))))))(position((start_p(""4 83 129))(end_p(""4 83 138))))))))(position((start_p(""4 83 113))(end_p(""4 83 139))))))))(position((start_p(""4 83 85))(end_p(""4 83 139)))))((value(Variable((value(Id x))(position((start_p(""4 83 143))(end_p(""4 83 144)))))()))(position((start_p(""4 83 143))(end_p(""4 83 144)))))))(position((start_p(""4 83 85))(end_p(""4 83 144))))))))(position((start_p(""3 40 54))(end_p(""5 145 146)))))))))(position((start_p(""3 40 40))(end_p(""5 145 146)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix.human-readable b/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix.human-readable new file mode 100644 index 0000000..798f919 --- /dev/null +++ b/flap/tests/03-Typing/43-pattern-matching-07.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type or<`a, `b> = Left(`a) | Right(`b) + +let x : int = match (Left(22)) { + Left((x : int)) | Right((x : int)) -> x +} \ No newline at end of file diff --git a/flap/tests/03-Typing/44-pattern-matching-08.bad.expected b/flap/tests/03-Typing/44-pattern-matching-08.bad.expected new file mode 100644 index 0000000..04c71fb --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + The variable x has already appeared in this pattern. diff --git a/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix b/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix new file mode 100644 index 0000000..6a6869b --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 28 32))(end_p(""3 28 33)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 36))(end_p(""3 28 39)))))))(position((start_p(""3 28 36))(end_p(""3 28 39))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 28 49))(end_p(""3 28 50)))))((((value(TyCon(TCon int)()))(position((start_p(""3 28 52))(end_p(""3 28 55)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 57))(end_p(""3 28 60)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 28 63))(end_p(""3 28 65)))))))(position((start_p(""3 28 63))(end_p(""3 28 65)))))((value(Literal((value(LInt 33))(position((start_p(""3 28 67))(end_p(""3 28 69)))))))(position((start_p(""3 28 67))(end_p(""3 28 69))))))))(position((start_p(""3 28 49))(end_p(""3 28 70)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""4 74 76))(end_p(""4 74 77)))))((((value(TyCon(TCon int)()))(position((start_p(""4 74 78))(end_p(""4 74 81)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 83))(end_p(""4 74 86)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 74 89))(end_p(""4 74 90)))))))(position((start_p(""4 74 89))(end_p(""4 74 90)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 93))(end_p(""4 74 96)))))))(position((start_p(""4 74 88))(end_p(""4 74 97)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 74 100))(end_p(""4 74 101)))))))(position((start_p(""4 74 100))(end_p(""4 74 101)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 104))(end_p(""4 74 107)))))))(position((start_p(""4 74 99))(end_p(""4 74 108))))))))(position((start_p(""4 74 76))(end_p(""4 74 109)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 74 115))(end_p(""4 74 116)))))()))(position((start_p(""4 74 115))(end_p(""4 74 116)))))((value(Variable((value(Id x))(position((start_p(""4 74 113))(end_p(""4 74 114)))))()))(position((start_p(""4 74 113))(end_p(""4 74 114)))))))(position((start_p(""4 74 113))(end_p(""4 74 114)))))((value(Variable((value(Id x))(position((start_p(""4 74 117))(end_p(""4 74 118)))))()))(position((start_p(""4 74 117))(end_p(""4 74 118)))))))(position((start_p(""4 74 113))(end_p(""4 74 118)))))))(position((start_p(""4 74 76))(end_p(""4 74 118))))))))(position((start_p(""3 28 42))(end_p(""5 119 120)))))))))(position((start_p(""3 28 28))(end_p(""5 119 120)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix.human-readable b/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix.human-readable new file mode 100644 index 0000000..4a1502b --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a, `b) + +let x : int = match (P (22, 33)) { + P((x : int), (x : int)) -> x + x +} \ No newline at end of file diff --git a/flap/tests/03-Typing/44-pattern-matching-08.good.expected b/flap/tests/03-Typing/44-pattern-matching-08.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix b/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix new file mode 100644 index 0000000..2d384f5 --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 28 32))(end_p(""3 28 33)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 36))(end_p(""3 28 39)))))))(position((start_p(""3 28 36))(end_p(""3 28 39))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 28 49))(end_p(""3 28 50)))))((((value(TyCon(TCon int)()))(position((start_p(""3 28 52))(end_p(""3 28 55)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 57))(end_p(""3 28 60)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 28 63))(end_p(""3 28 65)))))))(position((start_p(""3 28 63))(end_p(""3 28 65)))))((value(Literal((value(LInt 33))(position((start_p(""3 28 67))(end_p(""3 28 69)))))))(position((start_p(""3 28 67))(end_p(""3 28 69))))))))(position((start_p(""3 28 49))(end_p(""3 28 70)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""4 74 76))(end_p(""4 74 77)))))((((value(TyCon(TCon int)()))(position((start_p(""4 74 78))(end_p(""4 74 81)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 83))(end_p(""4 74 86)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 74 89))(end_p(""4 74 90)))))))(position((start_p(""4 74 89))(end_p(""4 74 90)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 93))(end_p(""4 74 96)))))))(position((start_p(""4 74 88))(end_p(""4 74 97)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""4 74 100))(end_p(""4 74 101)))))))(position((start_p(""4 74 100))(end_p(""4 74 101)))))((value(TyCon(TCon int)()))(position((start_p(""4 74 104))(end_p(""4 74 107)))))))(position((start_p(""4 74 99))(end_p(""4 74 108))))))))(position((start_p(""4 74 76))(end_p(""4 74 109)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 74 115))(end_p(""4 74 116)))))()))(position((start_p(""4 74 115))(end_p(""4 74 116)))))((value(Variable((value(Id x))(position((start_p(""4 74 113))(end_p(""4 74 114)))))()))(position((start_p(""4 74 113))(end_p(""4 74 114)))))))(position((start_p(""4 74 113))(end_p(""4 74 114)))))((value(Variable((value(Id y))(position((start_p(""4 74 117))(end_p(""4 74 118)))))()))(position((start_p(""4 74 117))(end_p(""4 74 118)))))))(position((start_p(""4 74 113))(end_p(""4 74 118)))))))(position((start_p(""4 74 76))(end_p(""4 74 118))))))))(position((start_p(""3 28 42))(end_p(""5 119 120)))))))))(position((start_p(""3 28 28))(end_p(""5 119 120)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix.human-readable b/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix.human-readable new file mode 100644 index 0000000..80b2e18 --- /dev/null +++ b/flap/tests/03-Typing/44-pattern-matching-08.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a, `b) + +let x : int = match (P (22, 33)) { + P((x : int), (y : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/45-pattern-matching-09.bad.expected b/flap/tests/03-Typing/45-pattern-matching-09.bad.expected new file mode 100644 index 0000000..5216c26 --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + This expression has type p which should be a function type. diff --git a/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix b/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix new file mode 100644 index 0000000..de7aa7a --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 22)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 24 28))(end_p(""3 24 29)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 24 32))(end_p(""3 24 35)))))))(position((start_p(""3 24 32))(end_p(""3 24 35))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 24 45))(end_p(""3 24 46)))))((((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 24 49))(end_p(""3 24 52)))))((value(TyCon(TCon int)()))(position((start_p(""3 24 54))(end_p(""3 24 57))))))))(position((start_p(""3 24 47))(end_p(""3 24 58)))))((value(TyCon(TCon int)()))(position((start_p(""3 24 60))(end_p(""3 24 63)))))))(((value(Tagged((value(KId P))(position((start_p(""3 24 65))(end_p(""3 24 66)))))((((value(TyCon(TCon int)()))(position((start_p(""3 24 67))(end_p(""3 24 70)))))((value(TyCon(TCon int)()))(position((start_p(""3 24 72))(end_p(""3 24 75)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 24 77))(end_p(""3 24 79)))))))(position((start_p(""3 24 77))(end_p(""3 24 79)))))((value(Literal((value(LInt 44))(position((start_p(""3 24 81))(end_p(""3 24 83)))))))(position((start_p(""3 24 81))(end_p(""3 24 83))))))))(position((start_p(""3 24 65))(end_p(""3 24 84)))))((value(Literal((value(LInt 33))(position((start_p(""3 24 86))(end_p(""3 24 88)))))))(position((start_p(""3 24 86))(end_p(""3 24 88))))))))(position((start_p(""3 24 45))(end_p(""3 24 89)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""4 93 95))(end_p(""4 93 96)))))((((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""4 93 99))(end_p(""4 93 102)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 104))(end_p(""4 93 107))))))))(position((start_p(""4 93 97))(end_p(""4 93 108)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 110))(end_p(""4 93 113)))))))(((value(PTaggedValue((value(KId P))(position((start_p(""4 93 115))(end_p(""4 93 116)))))((((value(TyCon(TCon int)()))(position((start_p(""4 93 117))(end_p(""4 93 120)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 122))(end_p(""4 93 125)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 93 128))(end_p(""4 93 129)))))))(position((start_p(""4 93 128))(end_p(""4 93 129)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 132))(end_p(""4 93 135)))))))(position((start_p(""4 93 127))(end_p(""4 93 136)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""4 93 139))(end_p(""4 93 140)))))))(position((start_p(""4 93 139))(end_p(""4 93 140)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 143))(end_p(""4 93 146)))))))(position((start_p(""4 93 138))(end_p(""4 93 147))))))))(position((start_p(""4 93 115))(end_p(""4 93 148)))))((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 93 151))(end_p(""4 93 152)))))((value(TyCon(TCon int)()))(position((start_p(""4 93 155))(end_p(""4 93 158)))))))(position((start_p(""4 93 150))(end_p(""4 93 159))))))))(position((start_p(""4 93 95))(end_p(""4 93 160)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 93 166))(end_p(""4 93 167)))))()))(position((start_p(""4 93 166))(end_p(""4 93 167)))))((value(Variable((value(Id x))(position((start_p(""4 93 164))(end_p(""4 93 165)))))()))(position((start_p(""4 93 164))(end_p(""4 93 165)))))))(position((start_p(""4 93 164))(end_p(""4 93 165)))))((value(Variable((value(Id y))(position((start_p(""4 93 168))(end_p(""4 93 169)))))()))(position((start_p(""4 93 168))(end_p(""4 93 169)))))))(position((start_p(""4 93 164))(end_p(""4 93 169)))))))(position((start_p(""4 93 95))(end_p(""4 93 169))))))))(position((start_p(""3 24 38))(end_p(""5 170 171)))))))))(position((start_p(""3 24 24))(end_p(""5 170 171)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix.human-readable b/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix.human-readable new file mode 100644 index 0000000..5834ca1 --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a) + +let x : int = match (P, int>(P(22, 44), 33)) { + P, int>(P((x : int), (y : int)), (_ : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/45-pattern-matching-09.good.expected b/flap/tests/03-Typing/45-pattern-matching-09.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix b/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix new file mode 100644 index 0000000..6542aeb --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 28 32))(end_p(""3 28 33)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 36))(end_p(""3 28 39)))))))(position((start_p(""3 28 36))(end_p(""3 28 39))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 28 49))(end_p(""3 28 50)))))((((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""3 28 53))(end_p(""3 28 56)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 58))(end_p(""3 28 61))))))))(position((start_p(""3 28 51))(end_p(""3 28 62)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 64))(end_p(""3 28 67)))))))(((value(Tagged((value(KId P))(position((start_p(""3 28 69))(end_p(""3 28 70)))))((((value(TyCon(TCon int)()))(position((start_p(""3 28 71))(end_p(""3 28 74)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 76))(end_p(""3 28 79)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 28 81))(end_p(""3 28 83)))))))(position((start_p(""3 28 81))(end_p(""3 28 83)))))((value(Literal((value(LInt 44))(position((start_p(""3 28 85))(end_p(""3 28 87)))))))(position((start_p(""3 28 85))(end_p(""3 28 87))))))))(position((start_p(""3 28 69))(end_p(""3 28 88)))))((value(Literal((value(LInt 33))(position((start_p(""3 28 90))(end_p(""3 28 92)))))))(position((start_p(""3 28 90))(end_p(""3 28 92))))))))(position((start_p(""3 28 49))(end_p(""3 28 93)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""4 97 99))(end_p(""4 97 100)))))((((value(TyCon(TCon p)(((value(TyCon(TCon int)()))(position((start_p(""4 97 103))(end_p(""4 97 106)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 108))(end_p(""4 97 111))))))))(position((start_p(""4 97 101))(end_p(""4 97 112)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 114))(end_p(""4 97 117)))))))(((value(PTaggedValue((value(KId P))(position((start_p(""4 97 119))(end_p(""4 97 120)))))((((value(TyCon(TCon int)()))(position((start_p(""4 97 121))(end_p(""4 97 124)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 126))(end_p(""4 97 129)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 97 132))(end_p(""4 97 133)))))))(position((start_p(""4 97 132))(end_p(""4 97 133)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 136))(end_p(""4 97 139)))))))(position((start_p(""4 97 131))(end_p(""4 97 140)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""4 97 143))(end_p(""4 97 144)))))))(position((start_p(""4 97 143))(end_p(""4 97 144)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 147))(end_p(""4 97 150)))))))(position((start_p(""4 97 142))(end_p(""4 97 151))))))))(position((start_p(""4 97 119))(end_p(""4 97 152)))))((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 97 155))(end_p(""4 97 156)))))((value(TyCon(TCon int)()))(position((start_p(""4 97 159))(end_p(""4 97 162)))))))(position((start_p(""4 97 154))(end_p(""4 97 163))))))))(position((start_p(""4 97 99))(end_p(""4 97 164)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 97 170))(end_p(""4 97 171)))))()))(position((start_p(""4 97 170))(end_p(""4 97 171)))))((value(Variable((value(Id x))(position((start_p(""4 97 168))(end_p(""4 97 169)))))()))(position((start_p(""4 97 168))(end_p(""4 97 169)))))))(position((start_p(""4 97 168))(end_p(""4 97 169)))))((value(Variable((value(Id y))(position((start_p(""4 97 172))(end_p(""4 97 173)))))()))(position((start_p(""4 97 172))(end_p(""4 97 173)))))))(position((start_p(""4 97 168))(end_p(""4 97 173)))))))(position((start_p(""4 97 99))(end_p(""4 97 173))))))))(position((start_p(""3 28 42))(end_p(""5 174 175)))))))))(position((start_p(""3 28 28))(end_p(""5 174 175)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix.human-readable b/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix.human-readable new file mode 100644 index 0000000..e694b75 --- /dev/null +++ b/flap/tests/03-Typing/45-pattern-matching-09.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a, `b) + +let x : int = match (P, int>(P(22, 44), 33)) { + P, int>(P((x : int), (y : int)), (_ : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/46-pattern-matching-10.bad.expected b/flap/tests/03-Typing/46-pattern-matching-10.bad.expected new file mode 100644 index 0000000..04c71fb --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + The variable x has already appeared in this pattern. diff --git a/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix b/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix new file mode 100644 index 0000000..011aa88 --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 28 32))(end_p(""3 28 33)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 36))(end_p(""3 28 39)))))))(position((start_p(""3 28 36))(end_p(""3 28 39))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 28 49))(end_p(""3 28 50)))))((((value(TyCon(TCon int)()))(position((start_p(""3 28 51))(end_p(""3 28 54)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 56))(end_p(""3 28 59)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 28 61))(end_p(""3 28 63)))))))(position((start_p(""3 28 61))(end_p(""3 28 63)))))((value(Literal((value(LInt 33))(position((start_p(""3 28 65))(end_p(""3 28 67)))))))(position((start_p(""3 28 65))(end_p(""3 28 67))))))))(position((start_p(""3 28 49))(end_p(""3 28 68)))))(((value(Branch((value(PAnd(((value(PTaggedValue((value(KId P))(position((start_p(""4 72 74))(end_p(""4 72 75)))))((((value(TyCon(TCon int)()))(position((start_p(""4 72 76))(end_p(""4 72 79)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 81))(end_p(""4 72 84)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 72 87))(end_p(""4 72 88)))))))(position((start_p(""4 72 87))(end_p(""4 72 88)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 91))(end_p(""4 72 94)))))))(position((start_p(""4 72 86))(end_p(""4 72 95)))))((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 72 98))(end_p(""4 72 99)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 102))(end_p(""4 72 105)))))))(position((start_p(""4 72 97))(end_p(""4 72 106))))))))(position((start_p(""4 72 74))(end_p(""4 72 107)))))((value(PTaggedValue((value(KId P))(position((start_p(""4 72 110))(end_p(""4 72 111)))))((((value(TyCon(TCon int)()))(position((start_p(""4 72 112))(end_p(""4 72 115)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 117))(end_p(""4 72 120)))))))(((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 72 123))(end_p(""4 72 124)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 127))(end_p(""4 72 130)))))))(position((start_p(""4 72 122))(end_p(""4 72 131)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 72 134))(end_p(""4 72 135)))))))(position((start_p(""4 72 134))(end_p(""4 72 135)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 138))(end_p(""4 72 141)))))))(position((start_p(""4 72 133))(end_p(""4 72 142))))))))(position((start_p(""4 72 110))(end_p(""4 72 143))))))))(position((start_p(""4 72 74))(end_p(""4 72 143)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 72 149))(end_p(""4 72 150)))))()))(position((start_p(""4 72 149))(end_p(""4 72 150)))))((value(Variable((value(Id x))(position((start_p(""4 72 147))(end_p(""4 72 148)))))()))(position((start_p(""4 72 147))(end_p(""4 72 148)))))))(position((start_p(""4 72 147))(end_p(""4 72 148)))))((value(Variable((value(Id x))(position((start_p(""4 72 151))(end_p(""4 72 152)))))()))(position((start_p(""4 72 151))(end_p(""4 72 152)))))))(position((start_p(""4 72 147))(end_p(""4 72 152)))))))(position((start_p(""4 72 74))(end_p(""4 72 152))))))))(position((start_p(""3 28 42))(end_p(""5 153 154)))))))))(position((start_p(""3 28 28))(end_p(""5 153 154)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix.human-readable b/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix.human-readable new file mode 100644 index 0000000..4ac93d3 --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a, `b) + +let x : int = match (P(22, 33)) { + P((x : int), (_ : int)) & P((_ : int), (x : int)) -> x + x +} \ No newline at end of file diff --git a/flap/tests/03-Typing/46-pattern-matching-10.good.expected b/flap/tests/03-Typing/46-pattern-matching-10.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix b/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix new file mode 100644 index 0000000..b1243e7 --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""3 28 32))(end_p(""3 28 33)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 36))(end_p(""3 28 39)))))))(position((start_p(""3 28 36))(end_p(""3 28 39))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""3 28 49))(end_p(""3 28 50)))))((((value(TyCon(TCon int)()))(position((start_p(""3 28 51))(end_p(""3 28 54)))))((value(TyCon(TCon int)()))(position((start_p(""3 28 56))(end_p(""3 28 59)))))))(((value(Literal((value(LInt 22))(position((start_p(""3 28 61))(end_p(""3 28 63)))))))(position((start_p(""3 28 61))(end_p(""3 28 63)))))((value(Literal((value(LInt 33))(position((start_p(""3 28 65))(end_p(""3 28 67)))))))(position((start_p(""3 28 65))(end_p(""3 28 67))))))))(position((start_p(""3 28 49))(end_p(""3 28 68)))))(((value(Branch((value(PAnd(((value(PTaggedValue((value(KId P))(position((start_p(""4 72 74))(end_p(""4 72 75)))))((((value(TyCon(TCon int)()))(position((start_p(""4 72 76))(end_p(""4 72 79)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 81))(end_p(""4 72 84)))))))(((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""4 72 87))(end_p(""4 72 88)))))))(position((start_p(""4 72 87))(end_p(""4 72 88)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 91))(end_p(""4 72 94)))))))(position((start_p(""4 72 86))(end_p(""4 72 95)))))((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 72 98))(end_p(""4 72 99)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 102))(end_p(""4 72 105)))))))(position((start_p(""4 72 97))(end_p(""4 72 106))))))))(position((start_p(""4 72 74))(end_p(""4 72 107)))))((value(PTaggedValue((value(KId P))(position((start_p(""4 72 110))(end_p(""4 72 111)))))((((value(TyCon(TCon int)()))(position((start_p(""4 72 112))(end_p(""4 72 115)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 117))(end_p(""4 72 120)))))))(((value(PTypeAnnotation((value PWildcard)(position((start_p(""4 72 123))(end_p(""4 72 124)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 127))(end_p(""4 72 130)))))))(position((start_p(""4 72 122))(end_p(""4 72 131)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""4 72 134))(end_p(""4 72 135)))))))(position((start_p(""4 72 134))(end_p(""4 72 135)))))((value(TyCon(TCon int)()))(position((start_p(""4 72 138))(end_p(""4 72 141)))))))(position((start_p(""4 72 133))(end_p(""4 72 142))))))))(position((start_p(""4 72 110))(end_p(""4 72 143))))))))(position((start_p(""4 72 74))(end_p(""4 72 143)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""4 72 149))(end_p(""4 72 150)))))()))(position((start_p(""4 72 149))(end_p(""4 72 150)))))((value(Variable((value(Id x))(position((start_p(""4 72 147))(end_p(""4 72 148)))))()))(position((start_p(""4 72 147))(end_p(""4 72 148)))))))(position((start_p(""4 72 147))(end_p(""4 72 148)))))((value(Variable((value(Id y))(position((start_p(""4 72 151))(end_p(""4 72 152)))))()))(position((start_p(""4 72 151))(end_p(""4 72 152)))))))(position((start_p(""4 72 147))(end_p(""4 72 152)))))))(position((start_p(""4 72 74))(end_p(""4 72 152))))))))(position((start_p(""3 28 42))(end_p(""5 153 154)))))))))(position((start_p(""3 28 28))(end_p(""5 153 154)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix.human-readable b/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix.human-readable new file mode 100644 index 0000000..ff3897b --- /dev/null +++ b/flap/tests/03-Typing/46-pattern-matching-10.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +type p<`a, `b> = P(`a, `b) + +let x : int = match (P(22, 33)) { + P((x : int), (_ : int)) & P((_ : int), (y : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/47-pattern-matching-11.bad.expected b/flap/tests/03-Typing/47-pattern-matching-11.bad.expected new file mode 100644 index 0000000..b9db196 --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.bad.expected @@ -0,0 +1,2 @@ +Error (typechecking) + There is no type definition for label `u'. diff --git a/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix b/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix new file mode 100644 index 0000000..a13f9fb --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineType((value(TCon l))(position((start_p(""2 27 32))(end_p(""2 27 33)))))()(DefineRecordType((((value(LId l))(position((start_p(""2 27 38))(end_p(""2 27 39)))))((value(TyCon(TCon int)()))(position((start_p(""2 27 42))(end_p(""2 27 45))))))))))(position((start_p(""2 27 27))(end_p(""2 27 47)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""4 49 53))(end_p(""4 49 54)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 49 57))(end_p(""4 49 60)))))))(position((start_p(""4 49 57))(end_p(""4 49 60))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""4 49 70))(end_p(""4 49 71)))))((((value(TyCon(TCon l)()))(position((start_p(""4 49 72))(end_p(""4 49 73)))))((value(TyCon(TCon int)()))(position((start_p(""4 49 75))(end_p(""4 49 78)))))))(((value(Record((((value(LId l))(position((start_p(""4 49 82))(end_p(""4 49 83)))))((value(Literal((value(LInt 22))(position((start_p(""4 49 86))(end_p(""4 49 88)))))))(position((start_p(""4 49 86))(end_p(""4 49 88)))))))(())))(position((start_p(""4 49 80))(end_p(""4 49 92)))))((value(Literal((value(LInt 33))(position((start_p(""4 49 94))(end_p(""4 49 96)))))))(position((start_p(""4 49 94))(end_p(""4 49 96))))))))(position((start_p(""4 49 70))(end_p(""4 49 97)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""5 101 103))(end_p(""5 101 104)))))((((value(TyCon(TCon l)()))(position((start_p(""5 101 105))(end_p(""5 101 106)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 108))(end_p(""5 101 111)))))))(((value(PRecord((((value(LId u))(position((start_p(""5 101 116))(end_p(""5 101 117)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 101 121))(end_p(""5 101 122)))))))(position((start_p(""5 101 121))(end_p(""5 101 122)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 125))(end_p(""5 101 128)))))))(position((start_p(""5 101 120))(end_p(""5 101 129)))))))(())))(position((start_p(""5 101 114))(end_p(""5 101 133)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""5 101 136))(end_p(""5 101 137)))))))(position((start_p(""5 101 136))(end_p(""5 101 137)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 140))(end_p(""5 101 143)))))))(position((start_p(""5 101 135))(end_p(""5 101 144))))))))(position((start_p(""5 101 103))(end_p(""5 101 145)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""5 101 151))(end_p(""5 101 152)))))()))(position((start_p(""5 101 151))(end_p(""5 101 152)))))((value(Variable((value(Id x))(position((start_p(""5 101 149))(end_p(""5 101 150)))))()))(position((start_p(""5 101 149))(end_p(""5 101 150)))))))(position((start_p(""5 101 149))(end_p(""5 101 150)))))((value(Variable((value(Id y))(position((start_p(""5 101 153))(end_p(""5 101 154)))))()))(position((start_p(""5 101 153))(end_p(""5 101 154)))))))(position((start_p(""5 101 149))(end_p(""5 101 154)))))))(position((start_p(""5 101 103))(end_p(""5 101 154))))))))(position((start_p(""4 49 63))(end_p(""6 155 156)))))))))(position((start_p(""4 49 49))(end_p(""6 155 156)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix.human-readable b/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix.human-readable new file mode 100644 index 0000000..c5a8d39 --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.bad.typing.hopix.human-readable @@ -0,0 +1,6 @@ +type p<`a, `b> = P(`a, `b) +type l = { l : int } + +let x : int = match (P({ l = 22 }<>, 33)) { + P( { u = (x : int) }<>, (y : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/47-pattern-matching-11.good.expected b/flap/tests/03-Typing/47-pattern-matching-11.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix b/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix new file mode 100644 index 0000000..9ff3cbf --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineType((value(TCon p))(position((start_p(""1 0 5))(end_p(""1 0 6)))))(((value(TId `a))(position((start_p(""1 0 7))(end_p(""1 0 9)))))((value(TId `b))(position((start_p(""1 0 11))(end_p(""1 0 13))))))(DefineSumType((((value(KId P))(position((start_p(""1 0 17))(end_p(""1 0 18)))))(((value(TyVar(TId `a)))(position((start_p(""1 0 19))(end_p(""1 0 21)))))((value(TyVar(TId `b)))(position((start_p(""1 0 23))(end_p(""1 0 25)))))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineType((value(TCon l))(position((start_p(""2 27 32))(end_p(""2 27 33)))))()(DefineRecordType((((value(LId l))(position((start_p(""2 27 38))(end_p(""2 27 39)))))((value(TyCon(TCon int)()))(position((start_p(""2 27 42))(end_p(""2 27 45))))))))))(position((start_p(""2 27 27))(end_p(""2 27 47)))))((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""4 49 53))(end_p(""4 49 54)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""4 49 57))(end_p(""4 49 60)))))))(position((start_p(""4 49 57))(end_p(""4 49 60))))))((value(Case((value(Tagged((value(KId P))(position((start_p(""4 49 70))(end_p(""4 49 71)))))((((value(TyCon(TCon l)()))(position((start_p(""4 49 72))(end_p(""4 49 73)))))((value(TyCon(TCon int)()))(position((start_p(""4 49 75))(end_p(""4 49 78)))))))(((value(Record((((value(LId l))(position((start_p(""4 49 82))(end_p(""4 49 83)))))((value(Literal((value(LInt 22))(position((start_p(""4 49 86))(end_p(""4 49 88)))))))(position((start_p(""4 49 86))(end_p(""4 49 88)))))))(())))(position((start_p(""4 49 80))(end_p(""4 49 92)))))((value(Literal((value(LInt 33))(position((start_p(""4 49 94))(end_p(""4 49 96)))))))(position((start_p(""4 49 94))(end_p(""4 49 96))))))))(position((start_p(""4 49 70))(end_p(""4 49 97)))))(((value(Branch((value(PTaggedValue((value(KId P))(position((start_p(""5 101 103))(end_p(""5 101 104)))))((((value(TyCon(TCon l)()))(position((start_p(""5 101 105))(end_p(""5 101 106)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 108))(end_p(""5 101 111)))))))(((value(PRecord((((value(LId l))(position((start_p(""5 101 116))(end_p(""5 101 117)))))((value(PTypeAnnotation((value(PVariable((value(Id x))(position((start_p(""5 101 121))(end_p(""5 101 122)))))))(position((start_p(""5 101 121))(end_p(""5 101 122)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 125))(end_p(""5 101 128)))))))(position((start_p(""5 101 120))(end_p(""5 101 129)))))))(())))(position((start_p(""5 101 114))(end_p(""5 101 133)))))((value(PTypeAnnotation((value(PVariable((value(Id y))(position((start_p(""5 101 136))(end_p(""5 101 137)))))))(position((start_p(""5 101 136))(end_p(""5 101 137)))))((value(TyCon(TCon int)()))(position((start_p(""5 101 140))(end_p(""5 101 143)))))))(position((start_p(""5 101 135))(end_p(""5 101 144))))))))(position((start_p(""5 101 103))(end_p(""5 101 145)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""5 101 151))(end_p(""5 101 152)))))()))(position((start_p(""5 101 151))(end_p(""5 101 152)))))((value(Variable((value(Id x))(position((start_p(""5 101 149))(end_p(""5 101 150)))))()))(position((start_p(""5 101 149))(end_p(""5 101 150)))))))(position((start_p(""5 101 149))(end_p(""5 101 150)))))((value(Variable((value(Id y))(position((start_p(""5 101 153))(end_p(""5 101 154)))))()))(position((start_p(""5 101 153))(end_p(""5 101 154)))))))(position((start_p(""5 101 149))(end_p(""5 101 154)))))))(position((start_p(""5 101 103))(end_p(""5 101 154))))))))(position((start_p(""4 49 63))(end_p(""6 155 156)))))))))(position((start_p(""4 49 49))(end_p(""6 155 156)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix.human-readable b/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix.human-readable new file mode 100644 index 0000000..f60f667 --- /dev/null +++ b/flap/tests/03-Typing/47-pattern-matching-11.good.typing.hopix.human-readable @@ -0,0 +1,6 @@ +type p<`a, `b> = P(`a, `b) +type l = { l : int } + +let x : int = match (P({ l = 22 }<>, 33)) { + P( { l = (x : int) }<>, (y : int)) -> x + y +} \ No newline at end of file diff --git a/flap/tests/03-Typing/48-pattern-matching-12.bad.expected b/flap/tests/03-Typing/48-pattern-matching-12.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix b/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix new file mode 100644 index 0000000..beaf439 --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LString bar))(position((start_p(""1 0 25))(end_p(""1 0 26)))))))(position((start_p(""1 0 25))(end_p(""1 0 26)))))(((value(Branch((value(PLiteral((value(LInt 0))(position((start_p(""1 0 30))(end_p(""1 0 31)))))))(position((start_p(""1 0 30))(end_p(""1 0 31)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 35))(end_p(""1 0 36)))))))(position((start_p(""1 0 35))(end_p(""1 0 36)))))))(position((start_p(""1 0 30))(end_p(""1 0 36)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 40))(end_p(""1 0 41)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 44))(end_p(""1 0 47)))))))(position((start_p(""1 0 39))(end_p(""1 0 48)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 52))(end_p(""1 0 53)))))))(position((start_p(""1 0 52))(end_p(""1 0 53)))))))(position((start_p(""1 0 39))(end_p(""1 0 53))))))))(position((start_p(""1 0 14))(end_p(""1 0 55)))))))))(position((start_p(""1 0 0))(end_p(""1 0 55)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix.human-readable b/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix.human-readable new file mode 100644 index 0000000..00a7be5 --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match ("bar") { 0 -> 1 | (_ : int) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/48-pattern-matching-12.good.expected b/flap/tests/03-Typing/48-pattern-matching-12.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix b/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix new file mode 100644 index 0000000..774181b --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LInt 3))(position((start_p(""1 0 21))(end_p(""1 0 22)))))))(position((start_p(""1 0 21))(end_p(""1 0 22)))))(((value(Branch((value(PLiteral((value(LInt 0))(position((start_p(""1 0 26))(end_p(""1 0 27)))))))(position((start_p(""1 0 26))(end_p(""1 0 27)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 31))(end_p(""1 0 32)))))))(position((start_p(""1 0 31))(end_p(""1 0 32)))))))(position((start_p(""1 0 26))(end_p(""1 0 32)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 36))(end_p(""1 0 37)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 40))(end_p(""1 0 43)))))))(position((start_p(""1 0 35))(end_p(""1 0 44)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 48))(end_p(""1 0 49)))))))(position((start_p(""1 0 48))(end_p(""1 0 49)))))))(position((start_p(""1 0 35))(end_p(""1 0 49))))))))(position((start_p(""1 0 14))(end_p(""1 0 51)))))))))(position((start_p(""1 0 0))(end_p(""1 0 51)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix.human-readable b/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix.human-readable new file mode 100644 index 0000000..40e73b7 --- /dev/null +++ b/flap/tests/03-Typing/48-pattern-matching-12.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match (3) { 0 -> 1 | (_ : int) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/49-pattern-matching-13.bad.expected b/flap/tests/03-Typing/49-pattern-matching-13.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix b/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix new file mode 100644 index 0000000..db9738a --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LString Doctor))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 28))(end_p(""1 0 29)))))(((value(Branch((value(PLiteral((value(LString Doctor))(position((start_p(""1 0 40))(end_p(""1 0 41)))))))(position((start_p(""1 0 40))(end_p(""1 0 41)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))(position((start_p(""1 0 40))(end_p(""1 0 46)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 50))(end_p(""1 0 51)))))((value(TyCon(TCon int)()))(position((start_p(""1 0 54))(end_p(""1 0 57)))))))(position((start_p(""1 0 49))(end_p(""1 0 58)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 62))(end_p(""1 0 63)))))))(position((start_p(""1 0 62))(end_p(""1 0 63)))))))(position((start_p(""1 0 49))(end_p(""1 0 63))))))))(position((start_p(""1 0 14))(end_p(""1 0 65)))))))))(position((start_p(""1 0 0))(end_p(""1 0 65)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix.human-readable b/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix.human-readable new file mode 100644 index 0000000..2f796df --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match ("Doctor") { "Doctor" -> 1 | (_ : int) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/49-pattern-matching-13.good.expected b/flap/tests/03-Typing/49-pattern-matching-13.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix b/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix new file mode 100644 index 0000000..5b80c4e --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LString Doctor))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 28))(end_p(""1 0 29)))))(((value(Branch((value(PLiteral((value(LString Doctor))(position((start_p(""1 0 40))(end_p(""1 0 41)))))))(position((start_p(""1 0 40))(end_p(""1 0 41)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))(position((start_p(""1 0 45))(end_p(""1 0 46)))))))(position((start_p(""1 0 40))(end_p(""1 0 46)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 50))(end_p(""1 0 51)))))((value(TyCon(TCon string)()))(position((start_p(""1 0 54))(end_p(""1 0 60)))))))(position((start_p(""1 0 49))(end_p(""1 0 61)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 65))(end_p(""1 0 66)))))))(position((start_p(""1 0 65))(end_p(""1 0 66)))))))(position((start_p(""1 0 49))(end_p(""1 0 66))))))))(position((start_p(""1 0 14))(end_p(""1 0 68)))))))))(position((start_p(""1 0 0))(end_p(""1 0 68)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix.human-readable b/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix.human-readable new file mode 100644 index 0000000..5d859a7 --- /dev/null +++ b/flap/tests/03-Typing/49-pattern-matching-13.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match ("Doctor") { "Doctor" -> 1 | (_ : string) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/50-pattern-matching-14.bad.expected b/flap/tests/03-Typing/50-pattern-matching-14.bad.expected new file mode 100644 index 0000000..7f1a149 --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + char +Given: + int diff --git a/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix b/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix new file mode 100644 index 0000000..098d934 --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LChar x))(position((start_p(""1 0 21))(end_p(""1 0 24)))))))(position((start_p(""1 0 21))(end_p(""1 0 24)))))(((value(Branch((value(PLiteral((value(LInt 0))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 28))(end_p(""1 0 29)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 33))(end_p(""1 0 34)))))))(position((start_p(""1 0 33))(end_p(""1 0 34)))))))(position((start_p(""1 0 28))(end_p(""1 0 34)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 38))(end_p(""1 0 39)))))((value(TyCon(TCon char)()))(position((start_p(""1 0 42))(end_p(""1 0 46)))))))(position((start_p(""1 0 37))(end_p(""1 0 47)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 51))(end_p(""1 0 52)))))))(position((start_p(""1 0 51))(end_p(""1 0 52)))))))(position((start_p(""1 0 37))(end_p(""1 0 52))))))))(position((start_p(""1 0 14))(end_p(""1 0 54)))))))))(position((start_p(""1 0 0))(end_p(""1 0 54)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix.human-readable b/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix.human-readable new file mode 100644 index 0000000..13cd72f --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match ('x') { 0 -> 1 | (_ : char) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/50-pattern-matching-14.good.expected b/flap/tests/03-Typing/50-pattern-matching-14.good.expected new file mode 100644 index 0000000..c2f1b13 --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.good.expected @@ -0,0 +1 @@ +x : int diff --git a/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix b/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix new file mode 100644 index 0000000..90eea4a --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Case((value(Literal((value(LChar x))(position((start_p(""1 0 21))(end_p(""1 0 24)))))))(position((start_p(""1 0 21))(end_p(""1 0 24)))))(((value(Branch((value(PLiteral((value(LChar x))(position((start_p(""1 0 28))(end_p(""1 0 31)))))))(position((start_p(""1 0 28))(end_p(""1 0 31)))))((value(Literal((value(LInt 1))(position((start_p(""1 0 35))(end_p(""1 0 36)))))))(position((start_p(""1 0 35))(end_p(""1 0 36)))))))(position((start_p(""1 0 28))(end_p(""1 0 36)))))((value(Branch((value(PTypeAnnotation((value PWildcard)(position((start_p(""1 0 40))(end_p(""1 0 41)))))((value(TyCon(TCon char)()))(position((start_p(""1 0 44))(end_p(""1 0 48)))))))(position((start_p(""1 0 39))(end_p(""1 0 49)))))((value(Literal((value(LInt 0))(position((start_p(""1 0 53))(end_p(""1 0 54)))))))(position((start_p(""1 0 53))(end_p(""1 0 54)))))))(position((start_p(""1 0 39))(end_p(""1 0 54))))))))(position((start_p(""1 0 14))(end_p(""1 0 56)))))))))(position((start_p(""1 0 0))(end_p(""1 0 56)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix.human-readable b/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix.human-readable new file mode 100644 index 0000000..ae0c74b --- /dev/null +++ b/flap/tests/03-Typing/50-pattern-matching-14.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = match ('x') { 'x' -> 1 | (_ : char) -> 0 } \ No newline at end of file diff --git a/flap/tests/03-Typing/51-ref.bad.expected b/flap/tests/03-Typing/51-ref.bad.expected new file mode 100644 index 0000000..6f2052a --- /dev/null +++ b/flap/tests/03-Typing/51-ref.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + mut diff --git a/flap/tests/03-Typing/51-ref.bad.typing.hopix b/flap/tests/03-Typing/51-ref.bad.typing.hopix new file mode 100644 index 0000000..6a4eea2 --- /dev/null +++ b/flap/tests/03-Typing/51-ref.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""1 0 8))(end_p(""1 0 11)))))))(position((start_p(""1 0 8))(end_p(""1 0 11))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 19))(end_p(""1 0 20)))))))(position((start_p(""1 0 18))(end_p(""1 0 21)))))))(position((start_p(""1 0 14))(end_p(""1 0 21)))))))))(position((start_p(""1 0 0))(end_p(""1 0 21)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/51-ref.bad.typing.hopix.human-readable b/flap/tests/03-Typing/51-ref.bad.typing.hopix.human-readable new file mode 100644 index 0000000..fb16f44 --- /dev/null +++ b/flap/tests/03-Typing/51-ref.bad.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : int = ref (0) \ No newline at end of file diff --git a/flap/tests/03-Typing/51-ref.good.expected b/flap/tests/03-Typing/51-ref.good.expected new file mode 100644 index 0000000..0963344 --- /dev/null +++ b/flap/tests/03-Typing/51-ref.good.expected @@ -0,0 +1 @@ +x : mut diff --git a/flap/tests/03-Typing/51-ref.good.typing.hopix b/flap/tests/03-Typing/51-ref.good.typing.hopix new file mode 100644 index 0000000..49a9b20 --- /dev/null +++ b/flap/tests/03-Typing/51-ref.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/51-ref.good.typing.hopix.human-readable b/flap/tests/03-Typing/51-ref.good.typing.hopix.human-readable new file mode 100644 index 0000000..039073e --- /dev/null +++ b/flap/tests/03-Typing/51-ref.good.typing.hopix.human-readable @@ -0,0 +1 @@ +let x : mut = ref (0) \ No newline at end of file diff --git a/flap/tests/03-Typing/52-assign.bad.typing.hopix.human-readable b/flap/tests/03-Typing/52-assign.bad.typing.hopix.human-readable new file mode 100644 index 0000000..e95ffdd --- /dev/null +++ b/flap/tests/03-Typing/52-assign.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +let x : mut = 0 + +let main : unit = + x := 1 \ No newline at end of file diff --git a/flap/tests/03-Typing/52-assign.good.expected b/flap/tests/03-Typing/52-assign.good.expected new file mode 100644 index 0000000..7c7a984 --- /dev/null +++ b/flap/tests/03-Typing/52-assign.good.expected @@ -0,0 +1,2 @@ +x : mut +main : unit diff --git a/flap/tests/03-Typing/52-assign.good.typing.hopix b/flap/tests/03-Typing/52-assign.good.typing.hopix new file mode 100644 index 0000000..78655e9 --- /dev/null +++ b/flap/tests/03-Typing/52-assign.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon unit)()))(position((start_p(""3 28 39))(end_p(""3 28 43)))))))(position((start_p(""3 28 39))(end_p(""3 28 43))))))((value(Assign((value(Variable((value(Id x))(position((start_p(""4 46 50))(end_p(""4 46 51)))))()))(position((start_p(""4 46 50))(end_p(""4 46 51)))))((value(Literal((value(LInt 1))(position((start_p(""4 46 55))(end_p(""4 46 56)))))))(position((start_p(""4 46 55))(end_p(""4 46 56)))))))(position((start_p(""4 46 50))(end_p(""4 46 56)))))))))(position((start_p(""3 28 28))(end_p(""4 46 56)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/52-assign.good.typing.hopix.human-readable b/flap/tests/03-Typing/52-assign.good.typing.hopix.human-readable new file mode 100644 index 0000000..44b0071 --- /dev/null +++ b/flap/tests/03-Typing/52-assign.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +let x : mut = ref (0) + +let main : unit = + x := 1 \ No newline at end of file diff --git a/flap/tests/03-Typing/53-read.bad.expected b/flap/tests/03-Typing/53-read.bad.expected new file mode 100644 index 0000000..cae9c52 --- /dev/null +++ b/flap/tests/03-Typing/53-read.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + string +Given: + int diff --git a/flap/tests/03-Typing/53-read.bad.typing.hopix b/flap/tests/03-Typing/53-read.bad.typing.hopix new file mode 100644 index 0000000..3fc3d6e --- /dev/null +++ b/flap/tests/03-Typing/53-read.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon string)()))(position((start_p(""3 28 39))(end_p(""3 28 45)))))))(position((start_p(""3 28 39))(end_p(""3 28 45))))))((value(Read((value(Variable((value(Id x))(position((start_p(""4 48 53))(end_p(""4 48 54)))))()))(position((start_p(""4 48 53))(end_p(""4 48 54)))))))(position((start_p(""4 48 52))(end_p(""4 48 54)))))))))(position((start_p(""3 28 28))(end_p(""4 48 54)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/53-read.bad.typing.hopix.human-readable b/flap/tests/03-Typing/53-read.bad.typing.hopix.human-readable new file mode 100644 index 0000000..083c35a --- /dev/null +++ b/flap/tests/03-Typing/53-read.bad.typing.hopix.human-readable @@ -0,0 +1,4 @@ +let x : mut = ref (0) + +let main : string = + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/53-read.good.expected b/flap/tests/03-Typing/53-read.good.expected new file mode 100644 index 0000000..2fab0c6 --- /dev/null +++ b/flap/tests/03-Typing/53-read.good.expected @@ -0,0 +1,2 @@ +x : mut +main : int diff --git a/flap/tests/03-Typing/53-read.good.typing.hopix b/flap/tests/03-Typing/53-read.good.typing.hopix new file mode 100644 index 0000000..bd5d4ae --- /dev/null +++ b/flap/tests/03-Typing/53-read.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 39))(end_p(""3 28 42)))))))(position((start_p(""3 28 39))(end_p(""3 28 42))))))((value(Read((value(Variable((value(Id x))(position((start_p(""4 45 50))(end_p(""4 45 51)))))()))(position((start_p(""4 45 50))(end_p(""4 45 51)))))))(position((start_p(""4 45 49))(end_p(""4 45 51)))))))))(position((start_p(""3 28 28))(end_p(""4 45 51)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/53-read.good.typing.hopix.human-readable b/flap/tests/03-Typing/53-read.good.typing.hopix.human-readable new file mode 100644 index 0000000..8ee4ccf --- /dev/null +++ b/flap/tests/03-Typing/53-read.good.typing.hopix.human-readable @@ -0,0 +1,4 @@ +let x : mut = ref (0) + +let main : int = + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/54-sequence.bad.expected b/flap/tests/03-Typing/54-sequence.bad.expected new file mode 100644 index 0000000..c091cc2 --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + int +Given: + string diff --git a/flap/tests/03-Typing/54-sequence.bad.typing.hopix b/flap/tests/03-Typing/54-sequence.bad.typing.hopix new file mode 100644 index 0000000..ca7b345 --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 39))(end_p(""3 28 42)))))))(position((start_p(""3 28 39))(end_p(""3 28 42))))))((value(Sequence(((value(Assign((value(Variable((value(Id x))(position((start_p(""4 45 49))(end_p(""4 45 50)))))()))(position((start_p(""4 45 49))(end_p(""4 45 50)))))((value(Literal((value(LString bar))(position((start_p(""4 45 58))(end_p(""4 45 59)))))))(position((start_p(""4 45 58))(end_p(""4 45 59)))))))(position((start_p(""4 45 49))(end_p(""4 45 59)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 61 66))(end_p(""5 61 67)))))()))(position((start_p(""5 61 66))(end_p(""5 61 67)))))))(position((start_p(""5 61 65))(end_p(""5 61 67))))))))(position((start_p(""4 45 49))(end_p(""5 61 67)))))))))(position((start_p(""3 28 28))(end_p(""5 61 67)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/54-sequence.bad.typing.hopix.human-readable b/flap/tests/03-Typing/54-sequence.bad.typing.hopix.human-readable new file mode 100644 index 0000000..d54d0ce --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.bad.typing.hopix.human-readable @@ -0,0 +1,5 @@ +let x : mut = ref (0) + +let main : int = + x := "bar"; + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/54-sequence.good.expected b/flap/tests/03-Typing/54-sequence.good.expected new file mode 100644 index 0000000..2fab0c6 --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.good.expected @@ -0,0 +1,2 @@ +x : mut +main : int diff --git a/flap/tests/03-Typing/54-sequence.good.typing.hopix b/flap/tests/03-Typing/54-sequence.good.typing.hopix new file mode 100644 index 0000000..b96501a --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 0))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 39))(end_p(""3 28 42)))))))(position((start_p(""3 28 39))(end_p(""3 28 42))))))((value(Sequence(((value(Assign((value(Variable((value(Id x))(position((start_p(""4 45 49))(end_p(""4 45 50)))))()))(position((start_p(""4 45 49))(end_p(""4 45 50)))))((value(Literal((value(LInt 1))(position((start_p(""4 45 54))(end_p(""4 45 55)))))))(position((start_p(""4 45 54))(end_p(""4 45 55)))))))(position((start_p(""4 45 49))(end_p(""4 45 55)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 57 62))(end_p(""5 57 63)))))()))(position((start_p(""5 57 62))(end_p(""5 57 63)))))))(position((start_p(""5 57 61))(end_p(""5 57 63))))))))(position((start_p(""4 45 49))(end_p(""5 57 63)))))))))(position((start_p(""3 28 28))(end_p(""5 57 63)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/54-sequence.good.typing.hopix.human-readable b/flap/tests/03-Typing/54-sequence.good.typing.hopix.human-readable new file mode 100644 index 0000000..6761a0d --- /dev/null +++ b/flap/tests/03-Typing/54-sequence.good.typing.hopix.human-readable @@ -0,0 +1,5 @@ +let x : mut = ref (0) + +let main : int = + x := 1; + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/55-while.bad.expected b/flap/tests/03-Typing/55-while.bad.expected new file mode 100644 index 0000000..8eb7e6d --- /dev/null +++ b/flap/tests/03-Typing/55-while.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + mut +Given: + mut diff --git a/flap/tests/03-Typing/55-while.bad.typing.hopix b/flap/tests/03-Typing/55-while.bad.typing.hopix new file mode 100644 index 0000000..50ff717 --- /dev/null +++ b/flap/tests/03-Typing/55-while.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LString foo))(position((start_p(""1 0 28))(end_p(""1 0 29)))))))(position((start_p(""1 0 23))(end_p(""1 0 30)))))))(position((start_p(""1 0 19))(end_p(""1 0 30)))))))))(position((start_p(""1 0 0))(end_p(""1 0 30)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 32 36))(end_p(""3 32 40)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 32 43))(end_p(""3 32 46)))))))(position((start_p(""3 32 43))(end_p(""3 32 46))))))((value(Sequence(((value(While((value(Apply((value(Apply((value(Variable((value(Id `>?`))(position((start_p(""4 49 63))(end_p(""4 49 65)))))()))(position((start_p(""4 49 63))(end_p(""4 49 65)))))((value(Read((value(Variable((value(Id x))(position((start_p(""4 49 61))(end_p(""4 49 62)))))()))(position((start_p(""4 49 61))(end_p(""4 49 62)))))))(position((start_p(""4 49 60))(end_p(""4 49 62)))))))(position((start_p(""4 49 60))(end_p(""4 49 62)))))((value(Literal((value(LInt 0))(position((start_p(""4 49 66))(end_p(""4 49 67)))))))(position((start_p(""4 49 66))(end_p(""4 49 67)))))))(position((start_p(""4 49 60))(end_p(""4 49 67)))))((value(Assign((value(Variable((value(Id x))(position((start_p(""5 71 77))(end_p(""5 71 78)))))()))(position((start_p(""5 71 77))(end_p(""5 71 78)))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""5 71 85))(end_p(""5 71 86)))))()))(position((start_p(""5 71 85))(end_p(""5 71 86)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 71 83))(end_p(""5 71 84)))))()))(position((start_p(""5 71 83))(end_p(""5 71 84)))))))(position((start_p(""5 71 82))(end_p(""5 71 84)))))))(position((start_p(""5 71 82))(end_p(""5 71 84)))))((value(Literal((value(LInt 1))(position((start_p(""5 71 87))(end_p(""5 71 88)))))))(position((start_p(""5 71 87))(end_p(""5 71 88)))))))(position((start_p(""5 71 82))(end_p(""5 71 88)))))))(position((start_p(""5 71 77))(end_p(""5 71 88)))))))(position((start_p(""4 49 53))(end_p(""6 89 94)))))((value(Read((value(Variable((value(Id x))(position((start_p(""7 96 101))(end_p(""7 96 102)))))()))(position((start_p(""7 96 101))(end_p(""7 96 102)))))))(position((start_p(""7 96 100))(end_p(""7 96 102))))))))(position((start_p(""4 49 53))(end_p(""7 96 102)))))))))(position((start_p(""3 32 32))(end_p(""7 96 102)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/55-while.bad.typing.hopix.human-readable b/flap/tests/03-Typing/55-while.bad.typing.hopix.human-readable new file mode 100644 index 0000000..8f5487c --- /dev/null +++ b/flap/tests/03-Typing/55-while.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +let x : mut = ref ("foo") + +let main : int = + while (!x >? 0) { + x := !x - 1 + }; + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/55-while.good.expected b/flap/tests/03-Typing/55-while.good.expected new file mode 100644 index 0000000..2fab0c6 --- /dev/null +++ b/flap/tests/03-Typing/55-while.good.expected @@ -0,0 +1,2 @@ +x : mut +main : int diff --git a/flap/tests/03-Typing/55-while.good.typing.hopix b/flap/tests/03-Typing/55-while.good.typing.hopix new file mode 100644 index 0000000..60130cf --- /dev/null +++ b/flap/tests/03-Typing/55-while.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 4))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 39))(end_p(""3 28 42)))))))(position((start_p(""3 28 39))(end_p(""3 28 42))))))((value(Sequence(((value(While((value(Apply((value(Apply((value(Variable((value(Id `>?`))(position((start_p(""4 45 59))(end_p(""4 45 61)))))()))(position((start_p(""4 45 59))(end_p(""4 45 61)))))((value(Read((value(Variable((value(Id x))(position((start_p(""4 45 57))(end_p(""4 45 58)))))()))(position((start_p(""4 45 57))(end_p(""4 45 58)))))))(position((start_p(""4 45 56))(end_p(""4 45 58)))))))(position((start_p(""4 45 56))(end_p(""4 45 58)))))((value(Literal((value(LInt 0))(position((start_p(""4 45 62))(end_p(""4 45 63)))))))(position((start_p(""4 45 62))(end_p(""4 45 63)))))))(position((start_p(""4 45 56))(end_p(""4 45 63)))))((value(Assign((value(Variable((value(Id x))(position((start_p(""5 67 73))(end_p(""5 67 74)))))()))(position((start_p(""5 67 73))(end_p(""5 67 74)))))((value(Apply((value(Apply((value(Variable((value(Id `-`))(position((start_p(""5 67 81))(end_p(""5 67 82)))))()))(position((start_p(""5 67 81))(end_p(""5 67 82)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 67 79))(end_p(""5 67 80)))))()))(position((start_p(""5 67 79))(end_p(""5 67 80)))))))(position((start_p(""5 67 78))(end_p(""5 67 80)))))))(position((start_p(""5 67 78))(end_p(""5 67 80)))))((value(Literal((value(LInt 1))(position((start_p(""5 67 83))(end_p(""5 67 84)))))))(position((start_p(""5 67 83))(end_p(""5 67 84)))))))(position((start_p(""5 67 78))(end_p(""5 67 84)))))))(position((start_p(""5 67 73))(end_p(""5 67 84)))))))(position((start_p(""4 45 49))(end_p(""6 85 90)))))((value(Read((value(Variable((value(Id x))(position((start_p(""7 92 97))(end_p(""7 92 98)))))()))(position((start_p(""7 92 97))(end_p(""7 92 98)))))))(position((start_p(""7 92 96))(end_p(""7 92 98))))))))(position((start_p(""4 45 49))(end_p(""7 92 98)))))))))(position((start_p(""3 28 28))(end_p(""7 92 98)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/55-while.good.typing.hopix.human-readable b/flap/tests/03-Typing/55-while.good.typing.hopix.human-readable new file mode 100644 index 0000000..16158a4 --- /dev/null +++ b/flap/tests/03-Typing/55-while.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +let x : mut = ref (4) + +let main : int = + while (!x >? 0) { + x := !x - 1 + }; + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/56-for.bad.expected b/flap/tests/03-Typing/56-for.bad.expected new file mode 100644 index 0000000..89e0ed1 --- /dev/null +++ b/flap/tests/03-Typing/56-for.bad.expected @@ -0,0 +1,6 @@ +Error (typechecking) + Type mismatch. +Expected: + mut +Given: + mut diff --git a/flap/tests/03-Typing/56-for.bad.typing.hopix b/flap/tests/03-Typing/56-for.bad.typing.hopix new file mode 100644 index 0000000..73dce53 --- /dev/null +++ b/flap/tests/03-Typing/56-for.bad.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon string)()))(position((start_p(""1 0 12))(end_p(""1 0 18))))))))(position((start_p(""1 0 8))(end_p(""1 0 19)))))))(position((start_p(""1 0 8))(end_p(""1 0 19))))))((value(Ref((value(Literal((value(LInt 4))(position((start_p(""1 0 27))(end_p(""1 0 28)))))))(position((start_p(""1 0 26))(end_p(""1 0 29)))))))(position((start_p(""1 0 22))(end_p(""1 0 29)))))))))(position((start_p(""1 0 0))(end_p(""1 0 29)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 31 35))(end_p(""3 31 39)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 31 42))(end_p(""3 31 45)))))))(position((start_p(""3 31 42))(end_p(""3 31 45))))))((value(Sequence(((value(For((value(Id i))(position((start_p(""4 48 56))(end_p(""4 48 57)))))((value(Literal((value(LInt 0))(position((start_p(""4 48 64))(end_p(""4 48 65)))))))(position((start_p(""4 48 64))(end_p(""4 48 65)))))((value(Literal((value(LInt 30))(position((start_p(""4 48 71))(end_p(""4 48 73)))))))(position((start_p(""4 48 71))(end_p(""4 48 73)))))((value(Assign((value(Variable((value(Id x))(position((start_p(""5 77 83))(end_p(""5 77 84)))))()))(position((start_p(""5 77 83))(end_p(""5 77 84)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""5 77 91))(end_p(""5 77 92)))))()))(position((start_p(""5 77 91))(end_p(""5 77 92)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 77 89))(end_p(""5 77 90)))))()))(position((start_p(""5 77 89))(end_p(""5 77 90)))))))(position((start_p(""5 77 88))(end_p(""5 77 90)))))))(position((start_p(""5 77 88))(end_p(""5 77 90)))))((value(Literal((value(LInt 1))(position((start_p(""5 77 93))(end_p(""5 77 94)))))))(position((start_p(""5 77 93))(end_p(""5 77 94)))))))(position((start_p(""5 77 88))(end_p(""5 77 94)))))))(position((start_p(""5 77 83))(end_p(""5 77 94)))))))(position((start_p(""4 48 52))(end_p(""6 95 100)))))((value(Read((value(Variable((value(Id x))(position((start_p(""7 102 107))(end_p(""7 102 108)))))()))(position((start_p(""7 102 107))(end_p(""7 102 108)))))))(position((start_p(""7 102 106))(end_p(""7 102 108))))))))(position((start_p(""4 48 52))(end_p(""7 102 108)))))))))(position((start_p(""3 31 31))(end_p(""7 102 108)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/56-for.bad.typing.hopix.human-readable b/flap/tests/03-Typing/56-for.bad.typing.hopix.human-readable new file mode 100644 index 0000000..b9e8455 --- /dev/null +++ b/flap/tests/03-Typing/56-for.bad.typing.hopix.human-readable @@ -0,0 +1,7 @@ +let x : mut = ref (4) + +let main : int = + for i from (0) to (30) { + x := !x + 1 + }; + !x \ No newline at end of file diff --git a/flap/tests/03-Typing/56-for.good.expected b/flap/tests/03-Typing/56-for.good.expected new file mode 100644 index 0000000..2fab0c6 --- /dev/null +++ b/flap/tests/03-Typing/56-for.good.expected @@ -0,0 +1,2 @@ +x : mut +main : int diff --git a/flap/tests/03-Typing/56-for.good.typing.hopix b/flap/tests/03-Typing/56-for.good.typing.hopix new file mode 100644 index 0000000..e33948e --- /dev/null +++ b/flap/tests/03-Typing/56-for.good.typing.hopix @@ -0,0 +1 @@ +(((value(DefineValue(SimpleValue(((value(Id x))(position((start_p(""1 0 4))(end_p(""1 0 5)))))(((value(ForallTy()((value(TyCon(TCon mut)(((value(TyCon(TCon int)()))(position((start_p(""1 0 12))(end_p(""1 0 15))))))))(position((start_p(""1 0 8))(end_p(""1 0 16)))))))(position((start_p(""1 0 8))(end_p(""1 0 16))))))((value(Ref((value(Literal((value(LInt 4))(position((start_p(""1 0 24))(end_p(""1 0 25)))))))(position((start_p(""1 0 23))(end_p(""1 0 26)))))))(position((start_p(""1 0 19))(end_p(""1 0 26)))))))))(position((start_p(""1 0 0))(end_p(""1 0 26)))))((value(DefineValue(SimpleValue(((value(Id main))(position((start_p(""3 28 32))(end_p(""3 28 36)))))(((value(ForallTy()((value(TyCon(TCon int)()))(position((start_p(""3 28 39))(end_p(""3 28 42)))))))(position((start_p(""3 28 39))(end_p(""3 28 42))))))((value(Sequence(((value(For((value(Id i))(position((start_p(""4 45 53))(end_p(""4 45 54)))))((value(Literal((value(LInt 0))(position((start_p(""4 45 61))(end_p(""4 45 62)))))))(position((start_p(""4 45 61))(end_p(""4 45 62)))))((value(Literal((value(LInt 30))(position((start_p(""4 45 68))(end_p(""4 45 70)))))))(position((start_p(""4 45 68))(end_p(""4 45 70)))))((value(Assign((value(Variable((value(Id x))(position((start_p(""5 74 80))(end_p(""5 74 81)))))()))(position((start_p(""5 74 80))(end_p(""5 74 81)))))((value(Apply((value(Apply((value(Variable((value(Id `+`))(position((start_p(""5 74 88))(end_p(""5 74 89)))))()))(position((start_p(""5 74 88))(end_p(""5 74 89)))))((value(Read((value(Variable((value(Id x))(position((start_p(""5 74 86))(end_p(""5 74 87)))))()))(position((start_p(""5 74 86))(end_p(""5 74 87)))))))(position((start_p(""5 74 85))(end_p(""5 74 87)))))))(position((start_p(""5 74 85))(end_p(""5 74 87)))))((value(Literal((value(LInt 1))(position((start_p(""5 74 90))(end_p(""5 74 91)))))))(position((start_p(""5 74 90))(end_p(""5 74 91)))))))(position((start_p(""5 74 85))(end_p(""5 74 91)))))))(position((start_p(""5 74 80))(end_p(""5 74 91)))))))(position((start_p(""4 45 49))(end_p(""6 92 97)))))((value(Read((value(Variable((value(Id x))(position((start_p(""7 99 104))(end_p(""7 99 105)))))()))(position((start_p(""7 99 104))(end_p(""7 99 105)))))))(position((start_p(""7 99 103))(end_p(""7 99 105))))))))(position((start_p(""4 45 49))(end_p(""7 99 105)))))))))(position((start_p(""3 28 28))(end_p(""7 99 105)))))) \ No newline at end of file diff --git a/flap/tests/03-Typing/56-for.good.typing.hopix.human-readable b/flap/tests/03-Typing/56-for.good.typing.hopix.human-readable new file mode 100644 index 0000000..a645033 --- /dev/null +++ b/flap/tests/03-Typing/56-for.good.typing.hopix.human-readable @@ -0,0 +1,7 @@ +let x : mut = ref (4) + +let main : int = + for i from (0) to (30) { + x := !x + 1 + }; + !x \ No newline at end of file diff --git a/flap/tests/Makefile b/flap/tests/Makefile index 4a5fd80..a1adea0 100644 --- a/flap/tests/Makefile +++ b/flap/tests/Makefile @@ -1,8 +1,10 @@ FLAP?=../_build/default/src/flap.exe JALONS=\ 01-Parsing.results \ - 01-Parsing-no-positions.results -EXTS=parsing.hopix parsing-no-positions.hopix + 01-Parsing-no-positions.results \ + 02-Interpreter.results \ + 03-Typing.results +EXTS=parsing.hopix parsing-no-positions.hopix eval.hopix typing.hopix .PHONY: all clean test FAKE .PRECIOUS: %.output %.expected %.score diff --git a/jalons/jalon-3.pdf b/jalons/jalon-3.pdf new file mode 100644 index 0000000..3fcbd6e Binary files /dev/null and b/jalons/jalon-3.pdf differ