Merge branch 'master' of gaufre.informatique.univ-paris-diderot.fr:aguatto/compilation-m1-2023
This commit is contained in:
commit
099ac3a73d
341 changed files with 1100 additions and 29 deletions
BIN
cours/cours-blocs.pdf
Normal file
BIN
cours/cours-blocs.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
cours/cours-typage.pdf
Normal file
BIN
cours/cours-typage.pdf
Normal file
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
6
flap/tests/03-Typing/01-int-literal.bad.expected
Normal file
6
flap/tests/03-Typing/01-int-literal.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
string
|
||||
Given:
|
||||
int
|
1
flap/tests/03-Typing/01-int-literal.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/01-int-literal.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1,2 @@
|
|||
let x : int = 42
|
||||
let y : string = -42
|
2
flap/tests/03-Typing/01-int-literal.good.expected
Normal file
2
flap/tests/03-Typing/01-int-literal.good.expected
Normal file
|
@ -0,0 +1,2 @@
|
|||
x : int
|
||||
y : int
|
1
flap/tests/03-Typing/01-int-literal.good.typing.hopix
Normal file
1
flap/tests/03-Typing/01-int-literal.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1,2 @@
|
|||
let x : int = 42
|
||||
let y : int = -42
|
6
flap/tests/03-Typing/02-arith-01.bad.expected
Normal file
6
flap/tests/03-Typing/02-arith-01.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
string
|
1
flap/tests/03-Typing/02-arith-01.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/02-arith-01.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 + "foo"
|
1
flap/tests/03-Typing/02-arith-01.good.expected
Normal file
1
flap/tests/03-Typing/02-arith-01.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
x : int
|
1
flap/tests/03-Typing/02-arith-01.good.typing.hopix
Normal file
1
flap/tests/03-Typing/02-arith-01.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 + 1
|
6
flap/tests/03-Typing/03-arith-02.bad.expected
Normal file
6
flap/tests/03-Typing/03-arith-02.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
char
|
1
flap/tests/03-Typing/03-arith-02.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/03-arith-02.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 * 'a'
|
1
flap/tests/03-Typing/03-arith-02.good.expected
Normal file
1
flap/tests/03-Typing/03-arith-02.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
x : int
|
1
flap/tests/03-Typing/03-arith-02.good.typing.hopix
Normal file
1
flap/tests/03-Typing/03-arith-02.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 * 2
|
6
flap/tests/03-Typing/04-arith-03.bad.expected
Normal file
6
flap/tests/03-Typing/04-arith-03.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
char
|
1
flap/tests/03-Typing/04-arith-03.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/04-arith-03.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 'a' - 2
|
1
flap/tests/03-Typing/04-arith-03.good.expected
Normal file
1
flap/tests/03-Typing/04-arith-03.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
x : int
|
1
flap/tests/03-Typing/04-arith-03.good.typing.hopix
Normal file
1
flap/tests/03-Typing/04-arith-03.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 - 2
|
6
flap/tests/03-Typing/06-arith-04.bad.expected
Normal file
6
flap/tests/03-Typing/06-arith-04.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
char
|
1
flap/tests/03-Typing/06-arith-04.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/06-arith-04.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 'a' / 'a'
|
1
flap/tests/03-Typing/06-arith-04.good.expected
Normal file
1
flap/tests/03-Typing/06-arith-04.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
x : int
|
1
flap/tests/03-Typing/06-arith-04.good.typing.hopix
Normal file
1
flap/tests/03-Typing/06-arith-04.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 / 2
|
6
flap/tests/03-Typing/07-arith-05.bad.expected
Normal file
6
flap/tests/03-Typing/07-arith-05.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
string
|
||||
Given:
|
||||
int
|
1
flap/tests/03-Typing/07-arith-05.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/07-arith-05.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : string = 1 / 2 + 3 * 5 - 6
|
1
flap/tests/03-Typing/07-arith-05.good.expected
Normal file
1
flap/tests/03-Typing/07-arith-05.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
x : int
|
1
flap/tests/03-Typing/07-arith-05.good.typing.hopix
Normal file
1
flap/tests/03-Typing/07-arith-05.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let x : int = 1 / 2 + 3 * 5 - 6
|
6
flap/tests/03-Typing/08-char-literal.bad.expected
Normal file
6
flap/tests/03-Typing/08-char-literal.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
char
|
1
flap/tests/03-Typing/08-char-literal.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/08-char-literal.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let c : int = 'a'
|
1
flap/tests/03-Typing/08-char-literal.good.expected
Normal file
1
flap/tests/03-Typing/08-char-literal.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
c : char
|
1
flap/tests/03-Typing/08-char-literal.good.typing.hopix
Normal file
1
flap/tests/03-Typing/08-char-literal.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let c : char = 'a'
|
6
flap/tests/03-Typing/09-char-string.bad.expected
Normal file
6
flap/tests/03-Typing/09-char-string.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
char
|
||||
Given:
|
||||
string
|
1
flap/tests/03-Typing/09-char-string.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/09-char-string.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let c : char = "Luke, I may be your father!"
|
1
flap/tests/03-Typing/09-char-string.good.expected
Normal file
1
flap/tests/03-Typing/09-char-string.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
c : string
|
1
flap/tests/03-Typing/09-char-string.good.typing.hopix
Normal file
1
flap/tests/03-Typing/09-char-string.good.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1 @@
|
|||
let c : string = "Luke, I may be your father!"
|
2
flap/tests/03-Typing/10-local-definition.bad.expected
Normal file
2
flap/tests/03-Typing/10-local-definition.bad.expected
Normal file
|
@ -0,0 +1,2 @@
|
|||
Error (typechecking)
|
||||
Unbound identifier `y'.
|
|
@ -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))))))
|
|
@ -0,0 +1,3 @@
|
|||
let main : int =
|
||||
let x : int = 1;
|
||||
y
|
1
flap/tests/03-Typing/10-local-definition.good.expected
Normal file
1
flap/tests/03-Typing/10-local-definition.good.expected
Normal file
|
@ -0,0 +1 @@
|
|||
main : int
|
|
@ -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))))))
|
|
@ -0,0 +1,3 @@
|
|||
let main : int =
|
||||
let x : int = 1;
|
||||
x
|
6
flap/tests/03-Typing/11-function-definition.bad.expected
Normal file
6
flap/tests/03-Typing/11-function-definition.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
string
|
||||
Given:
|
||||
int
|
|
@ -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))))))
|
|
@ -0,0 +1,5 @@
|
|||
fun : int -> string
|
||||
id (x : int) = x
|
||||
|
||||
let main : int =
|
||||
id (42)
|
|
@ -0,0 +1,2 @@
|
|||
id : int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -0,0 +1,5 @@
|
|||
fun : int -> int
|
||||
id (x : int) = x
|
||||
|
||||
let main : int =
|
||||
id (42)
|
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int
|
||||
Given:
|
||||
string
|
|
@ -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))))))
|
|
@ -0,0 +1,5 @@
|
|||
fun : int -> int
|
||||
id (x : int) = id x
|
||||
|
||||
let main : int =
|
||||
id "foo"
|
|
@ -0,0 +1,2 @@
|
|||
id : int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -0,0 +1,5 @@
|
|||
fun : int -> int
|
||||
id (x : int) = id x
|
||||
|
||||
let main : int =
|
||||
id 42
|
|
@ -0,0 +1,2 @@
|
|||
Error (typechecking)
|
||||
This expression has type int which should be a function type.
|
|
@ -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))))))
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
double_omega : int -> int
|
||||
omega : int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -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
|
6
flap/tests/03-Typing/14-binary-function.bad.expected
Normal file
6
flap/tests/03-Typing/14-binary-function.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int * int
|
||||
Given:
|
||||
int * int * int
|
1
flap/tests/03-Typing/14-binary-function.bad.typing.hopix
Normal file
1
flap/tests/03-Typing/14-binary-function.bad.typing.hopix
Normal file
|
@ -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))))))
|
|
@ -0,0 +1,4 @@
|
|||
fun : int * int -> int
|
||||
fst ((x : int), (y : int)) = x
|
||||
|
||||
let main : int = fst (3, 4, 4)
|
2
flap/tests/03-Typing/14-binary-function.good.expected
Normal file
2
flap/tests/03-Typing/14-binary-function.good.expected
Normal file
|
@ -0,0 +1,2 @@
|
|||
fst : int * int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -0,0 +1,4 @@
|
|||
fun : int * int -> int
|
||||
fst ((x : int), (y : int)) = x
|
||||
|
||||
let main : int = fst (3, 4)
|
6
flap/tests/03-Typing/14-binary-rec-function.bad.expected
Normal file
6
flap/tests/03-Typing/14-binary-rec-function.bad.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int * int
|
||||
Given:
|
||||
int
|
|
@ -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))))))
|
|
@ -0,0 +1,4 @@
|
|||
fun : int * int -> int
|
||||
fst ((x : int), (y : int)) = fst (y, x)
|
||||
|
||||
let main : int = fst 3 4
|
|
@ -0,0 +1,2 @@
|
|||
fst : int * int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -0,0 +1,4 @@
|
|||
fun : int * int -> int
|
||||
fst ((x : int), (y : int)) = fst (y, x)
|
||||
|
||||
let main : int = fst (3, 4)
|
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
int * int
|
||||
Given:
|
||||
int
|
|
@ -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))))))
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
fst : int * int -> int
|
||||
snd : int * int -> int
|
||||
main : int
|
|
@ -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))))))
|
|
@ -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)
|
|
@ -0,0 +1,6 @@
|
|||
Error (typechecking)
|
||||
Type mismatch.
|
||||
Expected:
|
||||
`a
|
||||
Given:
|
||||
int
|
|
@ -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))))))
|
|
@ -0,0 +1,4 @@
|
|||
fun : [`a] `a -> `a
|
||||
id (x : int) = x
|
||||
|
||||
let main : int = id<int> (37)
|
|
@ -0,0 +1,2 @@
|
|||
id : [`a] `a -> `a
|
||||
main : int
|
|
@ -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))))))
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue