Merge pull request #780 from rtfeldman/rvcas/rename_int

Rename Int to I64
This commit is contained in:
Richard Feldman 2020-12-07 22:49:39 -05:00 committed by GitHub
commit 149d10ea0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 447 additions and 447 deletions

View file

@ -54,12 +54,12 @@ mod repl_eval {
#[test] #[test]
fn literal_0x0() { fn literal_0x0() {
expect_success("0x0", "0 : Int"); expect_success("0x0", "0 : I64");
} }
#[test] #[test]
fn literal_0x42() { fn literal_0x42() {
expect_success("0x42", "66 : Int"); expect_success("0x42", "66 : I64");
} }
#[test] #[test]
@ -79,7 +79,7 @@ mod repl_eval {
#[test] #[test]
fn int_addition() { fn int_addition() {
expect_success("0x1 + 2", "3 : Int"); expect_success("0x1 + 2", "3 : I64");
} }
#[test] #[test]
@ -89,7 +89,7 @@ mod repl_eval {
#[test] #[test]
fn num_rem() { fn num_rem() {
expect_success("299 % 10", "Ok 9 : Result Int [ DivByZero ]*"); expect_success("299 % 10", "Ok 9 : Result I64 [ DivByZero ]*");
} }
#[test] #[test]
@ -191,7 +191,7 @@ mod repl_eval {
#[test] #[test]
fn str_count_graphemes() { fn str_count_graphemes() {
expect_success("Str.countGraphemes \"å🤔\"", "2 : Int"); expect_success("Str.countGraphemes \"å🤔\"", "2 : I64");
} }
#[test] #[test]
@ -206,7 +206,7 @@ mod repl_eval {
#[test] #[test]
fn literal_int_list() { fn literal_int_list() {
expect_success("[ 0x1, 0x2, 0x3 ]", "[ 1, 2, 3 ] : List Int"); expect_success("[ 0x1, 0x2, 0x3 ]", "[ 1, 2, 3 ] : List I64");
} }
#[test] #[test]
@ -239,7 +239,7 @@ mod repl_eval {
fn nested_int_list() { fn nested_int_list() {
expect_success( expect_success(
r#"[ [ [ 4, 3, 2 ], [ 1, 0x0 ] ], [ [] ], [] ]"#, r#"[ [ [ 4, 3, 2 ], [ 1, 0x0 ] ], [ [] ], [] ]"#,
r#"[ [ [ 4, 3, 2 ], [ 1, 0 ] ], [ [] ], [] ] : List (List (List Int))"#, r#"[ [ [ 4, 3, 2 ], [ 1, 0 ] ], [ [] ], [] ] : List (List (List I64))"#,
); );
} }
@ -316,7 +316,7 @@ mod repl_eval {
fn basic_2_field_i64_record() { fn basic_2_field_i64_record() {
expect_success( expect_success(
"{ foo: 0x4, bar: 0x2 }", "{ foo: 0x4, bar: 0x2 }",
"{ bar: 2, foo: 4 } : { bar : Int, foo : Int }", "{ bar: 2, foo: 4 } : { bar : I64, foo : I64 }",
); );
} }
@ -340,7 +340,7 @@ mod repl_eval {
fn basic_3_field_record() { fn basic_3_field_record() {
expect_success( expect_success(
"{ foo: 4.1, bar: 2, baz: 0x5 }", "{ foo: 4.1, bar: 2, baz: 0x5 }",
"{ bar: 2, baz: 5, foo: 4.1 } : { bar : Num *, baz : Int, foo : F64 }", "{ bar: 2, baz: 5, foo: 4.1 } : { bar : Num *, baz : I64, foo : F64 }",
); );
} }
@ -387,7 +387,7 @@ mod repl_eval {
fn list_of_3_field_records() { fn list_of_3_field_records() {
expect_success( expect_success(
"[ { foo: 4.1, bar: 2, baz: 0x3 } ]", "[ { foo: 4.1, bar: 2, baz: 0x3 } ]",
"[ { bar: 2, baz: 3, foo: 4.1 } ] : List { bar : Num *, baz : Int, foo : F64 }", "[ { bar: 2, baz: 3, foo: 4.1 } ] : List { bar : Num *, baz : I64, foo : F64 }",
); );
} }

View file

@ -1207,7 +1207,7 @@ fn int_type(u: VarId) -> SolvedType {
vec![ vec![
flex(u), flex(u),
SolvedType::Alias( SolvedType::Alias(
Symbol::NUM_INT, Symbol::NUM_I64,
Vec::new(), Vec::new(),
Box::new(builtin_aliases::num_type(SolvedType::Apply( Box::new(builtin_aliases::num_type(SolvedType::Apply(
Symbol::ATTR_ATTR, Symbol::ATTR_ATTR,

View file

@ -50,7 +50,7 @@ mod test_can {
assert_eq!(expected, actual); assert_eq!(expected, actual);
} }
actual => { actual => {
panic!("Expected an Int, but got: {:?}", actual); panic!("Expected an I64, but got: {:?}", actual);
} }
} }
} }
@ -249,7 +249,7 @@ mod test_can {
fn correct_annotated_body() { fn correct_annotated_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
f = \ a -> a f = \ a -> a
f f
@ -265,7 +265,7 @@ mod test_can {
fn correct_annotated_body_with_comments() { fn correct_annotated_body_with_comments() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int # comment f : I64 -> I64 # comment
f = \ a -> a f = \ a -> a
f f
@ -281,7 +281,7 @@ mod test_can {
fn name_mismatch_annotated_body() { fn name_mismatch_annotated_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
g = \ a -> a g = \ a -> a
g g
@ -307,7 +307,7 @@ mod test_can {
fn name_mismatch_annotated_body_with_comment() { fn name_mismatch_annotated_body_with_comment() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int # comment f : I64 -> I64 # comment
g = \ a -> a g = \ a -> a
g g
@ -333,7 +333,7 @@ mod test_can {
fn separated_annotated_body() { fn separated_annotated_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
f = \ a -> a f = \ a -> a
@ -354,7 +354,7 @@ mod test_can {
fn separated_annotated_body_with_comment() { fn separated_annotated_body_with_comment() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
# comment # comment
f = \ a -> a f = \ a -> a
@ -375,9 +375,9 @@ mod test_can {
fn shadowed_annotation() { fn shadowed_annotation() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
f : Int -> Int f : I64 -> I64
f f
"# "#
@ -397,7 +397,7 @@ mod test_can {
fn correct_nested_unannotated_body() { fn correct_nested_unannotated_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int f : I64
f = f =
g = 42 g = 42
@ -416,9 +416,9 @@ mod test_can {
fn correct_nested_annotated_body() { fn correct_nested_annotated_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int f : I64
f = f =
g : Int g : I64
g = 42 g = 42
g + 1 g + 1
@ -436,11 +436,11 @@ mod test_can {
fn correct_nested_body_annotated_multiple_lines() { fn correct_nested_body_annotated_multiple_lines() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int f : I64
f = f =
g : Int g : I64
g = 42 g = 42
h : Int h : I64
h = 5 h = 5
z = 4 z = 4
g + h + z g + h + z
@ -458,10 +458,10 @@ mod test_can {
fn correct_nested_body_unannotated_multiple_lines() { fn correct_nested_body_unannotated_multiple_lines() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int f : I64
f = f =
g = 42 g = 42
h : Int h : I64
h = 5 h = 5
z = 4 z = 4
g + h + z g + h + z
@ -478,7 +478,7 @@ mod test_can {
fn correct_double_nested_body() { fn correct_double_nested_body() {
let src = indoc!( let src = indoc!(
r#" r#"
f : Int f : I64
f = f =
g = g =
h = 42 h = 42
@ -499,7 +499,7 @@ mod test_can {
fn annotation_followed_with_unrelated_affectation() { fn annotation_followed_with_unrelated_affectation() {
let src = indoc!( let src = indoc!(
r#" r#"
F : Int F : I64
x = 1 x = 1
@ -520,9 +520,9 @@ mod test_can {
fn two_annotations_followed_with_unrelated_affectation() { fn two_annotations_followed_with_unrelated_affectation() {
let src = indoc!( let src = indoc!(
r#" r#"
G : Int G : I64
F : Int F : I64
x = 1 x = 1

View file

@ -92,7 +92,7 @@ pub fn num_floatingpoint() -> Type {
#[inline(always)] #[inline(always)]
pub fn num_int() -> Type { pub fn num_int() -> Type {
Type::Alias(Symbol::NUM_INT, vec![], Box::new(num_num(num_integer()))) Type::Alias(Symbol::NUM_I64, vec![], Box::new(num_num(num_integer())))
} }
#[inline(always)] #[inline(always)]

View file

@ -762,8 +762,8 @@ mod test_fmt {
expr_formats_to( expr_formats_to(
indoc!( indoc!(
r#" r#"
f: { y : Int, f: { y : I64,
x : Int , x : I64 ,
} }
f"# f"#
@ -772,8 +772,8 @@ mod test_fmt {
r#" r#"
f : f :
{ {
y : Int, y : I64,
x : Int, x : I64,
} }
f"# f"#
@ -787,8 +787,8 @@ mod test_fmt {
r#" r#"
f : f :
{ {
y : Int, y : I64,
x : Int, x : I64,
} }
f"# f"#
@ -800,7 +800,7 @@ mod test_fmt {
expr_formats_same(indoc!( expr_formats_same(indoc!(
r#" r#"
f : f :
Int I64
f"# f"#
)); ));
@ -880,7 +880,7 @@ mod test_fmt {
r#" r#"
f : f :
{ {
x: Int # comment 1 x: I64 # comment 1
, ,
# comment 2 # comment 2
} }
@ -891,7 +891,7 @@ mod test_fmt {
r#" r#"
f : f :
{ {
x : Int, x : I64,
# comment 1 # comment 1
# comment 2 # comment 2
} }
@ -2458,7 +2458,7 @@ mod test_fmt {
fn record_type() { fn record_type() {
expr_formats_same(indoc!( expr_formats_same(indoc!(
r#" r#"
f : { foo : Int } f : { foo : I64 }
f = { foo: 1000 } f = { foo: 1000 }
a a
@ -2509,11 +2509,11 @@ mod test_fmt {
// r#" // r#"
// f : // f :
// Result a // Result a
// { x : Int // { x : I64
// , y : Float // , y : Float
// } // }
// c // c
// -> Int // -> I64
// f = // f =
// \_ -> 4 // \_ -> 4
// "# // "#

View file

@ -162,7 +162,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
initThrees : List Int initThrees : List I64
initThrees = initThrees =
[] []
@ -204,7 +204,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
init : List Int init : List I64
init = init =
[] []
@ -251,7 +251,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
empty : List Int empty : List I64
empty = empty =
[] []
@ -330,7 +330,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
empty : List Int empty : List I64
empty = empty =
[] []
@ -347,7 +347,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
alwaysTrue : Int -> Bool alwaysTrue : I64 -> Bool
alwaysTrue = \_ -> alwaysTrue = \_ ->
True True
@ -365,11 +365,11 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
alwaysTrue : Int -> Bool alwaysTrue : I64 -> Bool
alwaysTrue = \_ -> alwaysTrue = \_ ->
True True
oneThroughEight : List Int oneThroughEight : List I64
oneThroughEight = oneThroughEight =
[1,2,3,4,5,6,7,8] [1,2,3,4,5,6,7,8]
@ -386,7 +386,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
alwaysFalse : Int -> Bool alwaysFalse : I64 -> Bool
alwaysFalse = \_ -> alwaysFalse = \_ ->
False False
@ -403,7 +403,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
intIsLessThanThree : Int -> Bool intIsLessThanThree : I64 -> Bool
intIsLessThanThree = \i -> intIsLessThanThree = \i ->
i < 3 i < 3
@ -440,7 +440,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
empty : List Int empty : List I64
empty = empty =
[] []
@ -457,7 +457,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
nonEmpty : List Int nonEmpty : List I64
nonEmpty = nonEmpty =
[ 1 ] [ 1 ]
@ -474,7 +474,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
nonEmpty : List Int nonEmpty : List I64
nonEmpty = nonEmpty =
[ 1 ] [ 1 ]
@ -491,7 +491,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
nonEmpty : List Int nonEmpty : List I64
nonEmpty = nonEmpty =
[ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ] [ 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ]
@ -510,7 +510,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
nonEmpty : List Int nonEmpty : List I64
nonEmpty = nonEmpty =
[ 1, 1, -4, 1, 2 ] [ 1, 1, -4, 1, 2 ]
@ -528,11 +528,11 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
nonEmpty : List Int nonEmpty : List I64
nonEmpty = nonEmpty =
[ 2, 2, -4, 2, 3 ] [ 2, 2, -4, 2, 3 ]
greaterThanOne : Int -> Bool greaterThanOne : I64 -> Bool
greaterThanOne = \i -> greaterThanOne = \i ->
i > 1 i > 1
@ -730,7 +730,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
emptyList : List Int emptyList : List I64
emptyList = emptyList =
[] []
@ -752,11 +752,11 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
firstList : List Int firstList : List I64
firstList = firstList =
[] []
secondList : List Int secondList : List I64
secondList = secondList =
[] []
@ -778,11 +778,11 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
firstList : List Int firstList : List I64
firstList = firstList =
[] []
secondList : List Int secondList : List I64
secondList = secondList =
[] []
@ -1229,7 +1229,7 @@ mod gen_list {
app "quicksort" provides [ main ] to "./platform" app "quicksort" provides [ main ] to "./platform"
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1254,7 +1254,7 @@ mod gen_list {
// assert_evals_to!( // assert_evals_to!(
// indoc!( // indoc!(
// r#" // r#"
// swap : Int, Int, List a -> List a // swap : I64, I64, List a -> List a
// swap = \i, j, list -> // swap = \i, j, list ->
// when Pair (List.get list i) (List.get list j) is // when Pair (List.get list i) (List.get list j) is
// Pair (Ok atI) (Ok atJ) -> // Pair (Ok atI) (Ok atJ) ->
@ -1264,7 +1264,7 @@ mod gen_list {
// //
// _ -> // _ ->
// [] // []
// partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] // partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
// partition = \low, high, initialList -> // partition = \low, high, initialList ->
// when List.get initialList high is // when List.get initialList high is
// Ok pivot -> // Ok pivot ->
@ -1276,7 +1276,7 @@ mod gen_list {
// Pair (low - 1) initialList // Pair (low - 1) initialList
// //
// //
// partitionHelp : Int, Int, List (Num a), Int, Int -> [ Pair Int (List (Num a)) ] // partitionHelp : I64, I64, List (Num a), I64, I64 -> [ Pair I64 (List (Num a)) ]
// partitionHelp = \i, j, list, high, pivot -> // partitionHelp = \i, j, list, high, pivot ->
// if j < high then // if j < high then
// when List.get list j is // when List.get list j is
@ -1306,7 +1306,7 @@ mod gen_list {
// assert_evals_to!( // assert_evals_to!(
// indoc!( // indoc!(
// r#" // r#"
// swap : Int, Int, List a -> List a // swap : I64, I64, List a -> List a
// swap = \i, j, list -> // swap = \i, j, list ->
// when Pair (List.get list i) (List.get list j) is // when Pair (List.get list i) (List.get list j) is
// Pair (Ok atI) (Ok atJ) -> // Pair (Ok atI) (Ok atJ) ->
@ -1316,7 +1316,7 @@ mod gen_list {
// //
// _ -> // _ ->
// [] // []
// partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] // partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
// partition = \low, high, initialList -> // partition = \low, high, initialList ->
// when List.get initialList high is // when List.get initialList high is
// Ok pivot -> // Ok pivot ->
@ -1328,7 +1328,7 @@ mod gen_list {
// Pair (low - 1) initialList // Pair (low - 1) initialList
// //
// //
// partitionHelp : Int, Int, List (Num a), Int, Int -> [ Pair Int (List (Num a)) ] // partitionHelp : I64, I64, List (Num a), I64, I64 -> [ Pair I64 (List (Num a)) ]
// //
// # when partition 0 0 [ 1,2,3,4,5 ] is // # when partition 0 0 [ 1,2,3,4,5 ] is
// # Pair list _ -> list // # Pair list _ -> list
@ -1352,7 +1352,7 @@ mod gen_list {
quicksortHelp list 0 (n - 1) quicksortHelp list 0 (n - 1)
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -1364,7 +1364,7 @@ mod gen_list {
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1375,7 +1375,7 @@ mod gen_list {
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -1387,7 +1387,7 @@ mod gen_list {
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -1422,7 +1422,7 @@ mod gen_list {
quicksortHelp list 0 (List.len list - 1) quicksortHelp list 0 (List.len list - 1)
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -1434,7 +1434,7 @@ mod gen_list {
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1445,7 +1445,7 @@ mod gen_list {
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -1457,7 +1457,7 @@ mod gen_list {
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, Num a -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, Num a -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
# if j < high then # if j < high then
if False then if False then
@ -1495,7 +1495,7 @@ mod gen_list {
quicksortHelp list 0 (List.len list - 1) quicksortHelp list 0 (List.len list - 1)
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -1507,7 +1507,7 @@ mod gen_list {
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1518,7 +1518,7 @@ mod gen_list {
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -1530,7 +1530,7 @@ mod gen_list {
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, Num a -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, Num a -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -1562,7 +1562,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : List Int x : List I64
x = [] x = []
List.len x + List.len x List.len x + List.len x
@ -1578,7 +1578,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : List Int x : List I64
x = [1,2,3] x = [1,2,3]
List.len x + List.len x List.len x + List.len x
@ -1594,10 +1594,10 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : List Int x : List I64
x = [1,2,3] x = [1,2,3]
id : List Int -> List Int id : List I64 -> List I64
id = \y -> y id = \y -> y
id x id x
@ -1613,10 +1613,10 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : List Int x : List I64
x = [1,2,3] x = [1,2,3]
id : List Int -> List Int id : List I64 -> List I64
id = \y -> List.set y 0 0 id = \y -> List.set y 0 0
id x id x
@ -1632,7 +1632,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
id : List Int -> [ Pair (List Int) Int ] id : List I64 -> [ Pair (List I64) I64 ]
id = \y -> Pair y 4 id = \y -> Pair y 4
when id [1,2,3] is when id [1,2,3] is

View file

@ -135,7 +135,7 @@ mod gen_primitives {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [ Pair Int Int ] x : [ Pair I64 I64 ]
x = Pair 0x2 0x3 x = Pair 0x2 0x3
when x is when x is
@ -152,7 +152,7 @@ mod gen_primitives {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [A Int, B Int] x : [A I64, B I64]
x = A 0x2 x = A 0x2
when x is when x is
@ -170,7 +170,7 @@ mod gen_primitives {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [A Int, B Int] x : [A I64, B I64]
x = B 0x3 x = B 0x3
when x is when x is
@ -293,7 +293,7 @@ mod gen_primitives {
indoc!( indoc!(
r#" r#"
wrapper = \{} -> wrapper = \{} ->
alwaysFloatIdentity : Int -> (F64 -> F64) alwaysFloatIdentity : I64 -> (F64 -> F64)
alwaysFloatIdentity = \_ -> alwaysFloatIdentity = \_ ->
(\a -> a) (\a -> a)
@ -557,14 +557,14 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
len : LinkedList a -> Int len : LinkedList a -> I64
len = \list -> len = \list ->
when list is when list is
Nil -> 0 Nil -> 0
Cons _ rest -> 1 + len rest Cons _ rest -> 1 + len rest
main = main =
nil : LinkedList Int nil : LinkedList I64
nil = Nil nil = Nil
len nil len nil
@ -584,10 +584,10 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
nil : LinkedList Int nil : LinkedList I64
nil = Nil nil = Nil
length : LinkedList a -> Int length : LinkedList a -> I64
length = \list -> length = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -611,10 +611,10 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
one : LinkedList Int one : LinkedList I64
one = Cons 1 Nil one = Cons 1 Nil
length : LinkedList a -> Int length : LinkedList a -> I64
length = \list -> length = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -638,10 +638,10 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
one : LinkedList Int one : LinkedList I64
one = Cons 1 Nil one = Cons 1 Nil
length : LinkedList a -> Int length : LinkedList a -> I64
length = \list -> length = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -665,10 +665,10 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
three : LinkedList Int three : LinkedList I64
three = Cons 3 (Cons 2 (Cons 1 Nil)) three = Cons 3 (Cons 2 (Cons 1 Nil))
length : LinkedList a -> Int length : LinkedList a -> I64
length = \list -> length = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -693,7 +693,7 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
three : LinkedList Int three : LinkedList I64
three = Cons 3 (Cons 2 (Cons 1 Nil)) three = Cons 3 (Cons 2 (Cons 1 Nil))
@ -721,10 +721,10 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
zero : LinkedList Int zero : LinkedList I64
zero = Nil zero = Nil
sum : LinkedList Int -> Int sum : LinkedList I64 -> I64
sum = \list -> sum = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -748,7 +748,7 @@ mod gen_primitives {
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
three : LinkedList Int three : LinkedList I64
three = Cons 3 (Cons 2 (Cons 1 Nil)) three = Cons 3 (Cons 2 (Cons 1 Nil))
sum : LinkedList (Num a) -> Num a sum : LinkedList (Num a) -> Num a
@ -779,7 +779,7 @@ mod gen_primitives {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just (Just 41) x = Just (Just 41)
when x is when x is
@ -796,7 +796,7 @@ mod gen_primitives {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just Nothing x = Just Nothing
when x is when x is
@ -814,7 +814,7 @@ mod gen_primitives {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Nothing x = Nothing
when x is when x is
@ -1128,7 +1128,7 @@ mod gen_primitives {
main : Bool main : Bool
main = main =
myList : ConsList Int myList : ConsList I64
myList = empty myList = empty
isEmpty myList isEmpty myList
@ -1159,7 +1159,7 @@ mod gen_primitives {
main : Bool main : Bool
main = main =
myList : ConsList Int myList : ConsList I64
myList = Cons 0x1 Nil myList = Cons 0x1 Nil
isEmpty myList isEmpty myList
@ -1177,16 +1177,16 @@ mod gen_primitives {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
State a : { count : Int, x : a } State a : { count : I64, x : a }
foo : State a -> Int foo : State a -> I64
foo = \state -> foo = \state ->
if state.count == 0 then if state.count == 0 then
0 0
else else
1 + foo { count: state.count - 1, x: state.x } 1 + foo { count: state.count - 1, x: state.x }
main : Int main : I64
main = main =
foo { count: 3, x: {} } foo { count: 3, x: {} }
"# "#
@ -1267,7 +1267,7 @@ mod gen_primitives {
_ -> _ ->
Node color key value left right Node color key value left right
main : Dict Int {} main : Dict I64 {}
main = main =
insert 0 {} Empty insert 0 {} Empty
"# "#
@ -1308,7 +1308,7 @@ mod gen_primitives {
_ -> _ ->
Empty Empty
main : Dict Int main : Dict I64
main = main =
balance Red 0 Empty Empty balance Red 0 Empty Empty
"# "#
@ -1331,7 +1331,7 @@ mod gen_primitives {
balance = \key, left -> balance = \key, left ->
Node key left Empty Node key left Empty
main : Dict Int main : Dict I64
main = main =
balance 0 Empty balance 0 Empty
"# "#
@ -1378,7 +1378,7 @@ mod gen_primitives {
_ -> _ ->
Empty Empty
main : Dict Int Int main : Dict I64 I64
main = main =
balance Red 0 0 Empty Empty balance Red 0 0 Empty Empty
"# "#
@ -1428,7 +1428,7 @@ mod gen_primitives {
_ -> _ ->
Node color key value left right Node color key value left right
main : Dict Int Int main : Dict I64 I64
main = main =
balance Red 0 0 Empty Empty balance Red 0 0 Empty Empty
"# "#
@ -1448,7 +1448,7 @@ mod gen_primitives {
ConsList a : [ Cons a (ConsList a), Nil ] ConsList a : [ Cons a (ConsList a), Nil ]
balance : ConsList Int -> Int balance : ConsList I64 -> I64
balance = \right -> balance = \right ->
when right is when right is
Cons 1 foo -> Cons 1 foo ->
@ -1457,7 +1457,7 @@ mod gen_primitives {
_ -> 3 _ -> 3
_ -> 3 _ -> 3
main : Int main : I64
main = main =
when balance Nil is when balance Nil is
_ -> 3 _ -> 3
@ -1474,13 +1474,13 @@ mod gen_primitives {
ConsList a : [ Cons a (ConsList a), Nil ] ConsList a : [ Cons a (ConsList a), Nil ]
balance : ConsList Int -> Int balance : ConsList I64 -> I64
balance = \right -> balance = \right ->
when right is when right is
Cons 1 (Cons 1 _) -> 3 Cons 1 (Cons 1 _) -> 3
_ -> 3 _ -> 3
main : Int main : I64
main = main =
when balance Nil is when balance Nil is
_ -> 3 _ -> 3
@ -1502,7 +1502,7 @@ mod gen_primitives {
ConsList a : [ Cons a (ConsList a), Nil ] ConsList a : [ Cons a (ConsList a), Nil ]
balance : ConsList Int -> Int balance : ConsList I64 -> I64
balance = \right -> balance = \right ->
when right is when right is
Cons 1 foo -> Cons 1 foo ->
@ -1511,7 +1511,7 @@ mod gen_primitives {
_ -> 3 _ -> 3
_ -> 3 _ -> 3
main : Int main : I64
main = main =
when balance Nil is when balance Nil is
_ -> 3 _ -> 3
@ -1531,13 +1531,13 @@ mod gen_primitives {
ConsList a : [ Cons a (ConsList a), Nil ] ConsList a : [ Cons a (ConsList a), Nil ]
foo : ConsList Int -> Int foo : ConsList I64 -> I64
foo = \list -> foo = \list ->
when list is when list is
Cons _ (Cons x _) -> x Cons _ (Cons x _) -> x
_ -> 0 _ -> 0
main : Int main : I64
main = main =
foo (Cons 1 (Cons 32 Nil)) foo (Cons 1 (Cons 32 Nil))
"# "#
@ -1554,15 +1554,15 @@ mod gen_primitives {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
BTree : [ Node BTree BTree, Leaf Int ] BTree : [ Node BTree BTree, Leaf I64 ]
foo : BTree -> Int foo : BTree -> I64
foo = \btree -> foo = \btree ->
when btree is when btree is
Node (Node (Leaf x) _) _ -> x Node (Node (Leaf x) _) _ -> x
_ -> 0 _ -> 0
main : Int main : I64
main = main =
foo (Node (Node (Leaf 32) (Leaf 0)) (Leaf 0)) foo (Node (Node (Leaf 32) (Leaf 0)) (Leaf 0))
"# "#

View file

@ -20,7 +20,7 @@ mod gen_tags {
r#" r#"
Maybe a : [ Just a, Nothing ] Maybe a : [ Just a, Nothing ]
x : Maybe Int x : Maybe I64
x = Nothing x = Nothing
x x
@ -39,7 +39,7 @@ mod gen_tags {
r#" r#"
Maybe a : [ Just a, Nothing ] Maybe a : [ Just a, Nothing ]
x : Maybe Int x : Maybe I64
x = Nothing x = Nothing
x x
@ -58,7 +58,7 @@ mod gen_tags {
r#" r#"
Maybe a : [ Just a, Nothing ] Maybe a : [ Just a, Nothing ]
y : Maybe Int y : Maybe I64
y = Just 0x4 y = Just 0x4
y y
@ -76,7 +76,7 @@ mod gen_tags {
r#" r#"
Maybe a : [ Just a, Nothing ] Maybe a : [ Just a, Nothing ]
y : Maybe Int y : Maybe I64
y = Just 0x4 y = Just 0x4
y y
@ -114,7 +114,7 @@ mod gen_tags {
// assert_evals_to!( // assert_evals_to!(
// indoc!( // indoc!(
// r#" // r#"
// x : Result Int Int // x : Result I64 I64
// x = Err 41 // x = Err 41
// x // x
@ -185,7 +185,7 @@ mod gen_tags {
// r#" // r#"
// LinkedList a : [ Cons a (LinkedList a), Nil ] // LinkedList a : [ Cons a (LinkedList a), Nil ]
// //
// empty : LinkedList Int // empty : LinkedList I64
// empty = Nil // empty = Nil
// //
// 1 // 1
@ -203,7 +203,7 @@ mod gen_tags {
// r#" // r#"
// LinkedList a : [ Cons a (LinkedList a), Nil ] // LinkedList a : [ Cons a (LinkedList a), Nil ]
// //
// singleton : LinkedList Int // singleton : LinkedList I64
// singleton = Cons 0x1 Nil // singleton = Cons 0x1 Nil
// //
// 1 // 1
@ -290,7 +290,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [ Nothing, Just Int ] x : [ Nothing, Just I64 ]
x = Nothing x = Nothing
when x is when x is
@ -308,7 +308,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [ Nothing, Just Int ] x : [ Nothing, Just I64 ]
x = Just 41 x = Just 41
when x is when x is
@ -326,7 +326,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : Result Int Int x : Result I64 I64
x = Err 41 x = Err 41
when x is when x is
@ -346,7 +346,7 @@ mod gen_tags {
r#" r#"
These a b : [ This a, That b, These a b ] These a b : [ This a, That b, These a b ]
x : These Int Int x : These I64 I64
x = These 0x3 0x2 x = These 0x3 0x2
when x is when x is
@ -398,7 +398,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : Result Int Int x : Result I64 I64
x = Ok 2 x = Ok 2
when x is when x is
@ -464,7 +464,7 @@ mod gen_tags {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just (Just 41) x = Just (Just 41)
when x is when x is
@ -558,7 +558,7 @@ mod gen_tags {
r#" r#"
Unit : [ Unit ] Unit : [ Unit ]
f : Unit -> Int f : Unit -> I64
f = \Unit -> 42 f = \Unit -> 42
f Unit f Unit
@ -587,7 +587,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
f : {} -> Int f : {} -> I64
f = \{} -> 42 f = \{} -> 42
f {} f {}
@ -614,7 +614,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
x : [ Pair Int ] x : [ Pair I64 ]
x = Pair 2 x = Pair 2
x x
@ -634,7 +634,7 @@ mod gen_tags {
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just (Just 41) x = Just (Just 41)
main = main =
@ -806,7 +806,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r"# r"#
x : [ Three Bool Int, Empty ] x : [ Three Bool I64, Empty ]
x = Three (1 == 1) 32 x = Three (1 == 1) 32
x x
@ -820,7 +820,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r"# r"#
x : [ Three Bool [ Red, Green, Blue ] Int, Empty ] x : [ Three Bool [ Red, Green, Blue ] I64, Empty ]
x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32 x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32
x x
@ -836,7 +836,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r"# r"#
x : [ Three Bool Int, Empty ] x : [ Three Bool I64, Empty ]
x = Three (1 == 1) 32 x = Three (1 == 1) 32
when x is when x is
@ -854,7 +854,7 @@ mod gen_tags {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r"# r"#
x : [ Three Bool [ Red, Green, Blue ] Int, Empty ] x : [ Three Bool [ Red, Green, Blue ] I64, Empty ]
x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32 x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32
when x is when x is

View file

@ -1,6 +1,6 @@
app "quicksort" provides [ swap, partition, partitionHelp, quicksort ] to "./platform" app "quicksort" provides [ swap, partition, partitionHelp, quicksort ] to "./platform"
quicksort : List (Num a), Int, Int -> List (Num a) quicksort : List (Num a), I64, I64 -> List (Num a)
quicksort = \list, low, high -> quicksort = \list, low, high ->
when partition low high list is when partition low high list is
Pair partitionIndex partitioned -> Pair partitionIndex partitioned ->
@ -9,7 +9,7 @@ quicksort = \list, low, high ->
|> quicksort (partitionIndex + 1) high |> quicksort (partitionIndex + 1) high
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -21,7 +21,7 @@ swap = \i, j, list ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -33,7 +33,7 @@ partition = \low, high, initialList ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is

View file

@ -1,7 +1,7 @@
app "quicksort" provides [ quicksort ] to "./platform" app "quicksort" provides [ quicksort ] to "./platform"
quicksort = \originalList -> quicksort = \originalList ->
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -13,7 +13,7 @@ quicksort = \originalList ->
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -24,7 +24,7 @@ quicksort = \originalList ->
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -36,7 +36,7 @@ quicksort = \originalList ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is

View file

@ -2,7 +2,7 @@ interface Quicksort
exposes [ swap, partition, quicksort ] exposes [ swap, partition, quicksort ]
imports [] imports []
quicksort : List (Num a), Int, Int -> List (Num a) quicksort : List (Num a), I64, I64 -> List (Num a)
quicksort = \list, low, high -> quicksort = \list, low, high ->
when partition low high list is when partition low high list is
Pair partitionIndex partitioned -> Pair partitionIndex partitioned ->
@ -11,7 +11,7 @@ quicksort = \list, low, high ->
|> quicksort (partitionIndex + 1) high |> quicksort (partitionIndex + 1) high
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -23,7 +23,7 @@ swap = \i, j, list ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -35,7 +35,7 @@ partition = \low, high, initialList ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is

View file

@ -265,7 +265,7 @@ mod test_load {
imports [ RBTree ] imports [ RBTree ]
provides [ main ] to blah provides [ main ] to blah
empty : RBTree.Dict Int Int empty : RBTree.Dict I64 I64
empty = RBTree.empty empty = RBTree.empty
main = empty main = empty
@ -360,7 +360,7 @@ mod test_load {
"floatTest" => "F64", "floatTest" => "F64",
"divisionFn" => "F64, F64 -> Result F64 [ DivByZero ]*", "divisionFn" => "F64, F64 -> Result F64 [ DivByZero ]*",
"divisionTest" => "Result F64 [ DivByZero ]*", "divisionTest" => "Result F64 [ DivByZero ]*",
"intTest" => "Int", "intTest" => "I64",
"x" => "F64", "x" => "F64",
"constantNum" => "Num *", "constantNum" => "Num *",
"divDep1ByDep2" => "Result F64 [ DivByZero ]*", "divDep1ByDep2" => "Result F64 [ DivByZero ]*",
@ -377,10 +377,10 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"swap" => "Int, Int, List a -> List a", "swap" => "I64, I64, List a -> List a",
"partition" => "Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ]", "partition" => "I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]",
"partitionHelp" => "Int, Int, List (Num a), Int, Num a -> [ Pair Int (List (Num a)) ]", "partitionHelp" => "I64, I64, List (Num a), I64, Num a -> [ Pair I64 (List (Num a)) ]",
"quicksort" => "List (Num a), Int, Int -> List (Num a)", "quicksort" => "List (Num a), I64, I64 -> List (Num a)",
}, },
); );
} }
@ -406,10 +406,10 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"swap" => "Int, Int, List a -> List a", "swap" => "I64, I64, List a -> List a",
"partition" => "Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ]", "partition" => "I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]",
"partitionHelp" => "Int, Int, List (Num a), Int, Num a -> [ Pair Int (List (Num a)) ]", "partitionHelp" => "I64, I64, List (Num a), I64, Num a -> [ Pair I64 (List (Num a)) ]",
"quicksort" => "List (Num a), Int, Int -> List (Num a)", "quicksort" => "List (Num a), I64, I64 -> List (Num a)",
}, },
); );
} }

View file

@ -235,7 +235,7 @@ mod test_uniq_load {
"floatTest" => "Attr Shared F64", "floatTest" => "Attr Shared F64",
"divisionFn" => "Attr Shared (Attr * F64, Attr * F64 -> Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*)))", "divisionFn" => "Attr Shared (Attr * F64, Attr * F64 -> Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*)))",
"divisionTest" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))", "divisionTest" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
"intTest" => "Attr * Int", "intTest" => "Attr * I64",
"x" => "Attr * F64", "x" => "Attr * F64",
"constantNum" => "Attr * (Num (Attr * *))", "constantNum" => "Attr * (Num (Attr * *))",
"divDep1ByDep2" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))", "divDep1ByDep2" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
@ -271,11 +271,11 @@ mod test_uniq_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"swap" => "Attr * (Attr * Int, Attr * Int, Attr * (List (Attr Shared a)) -> Attr * (List (Attr Shared a)))", "swap" => "Attr * (Attr * I64, Attr * I64, Attr * (List (Attr Shared a)) -> Attr * (List (Attr Shared a)))",
"partition" => "Attr * (Attr Shared Int, Attr Shared Int, Attr b (List (Attr Shared (Num (Attr Shared a)))) -> Attr * [ Pair (Attr * Int) (Attr b (List (Attr Shared (Num (Attr Shared a))))) ])", "partition" => "Attr * (Attr Shared I64, Attr Shared I64, Attr b (List (Attr Shared (Num (Attr Shared a)))) -> Attr * [ Pair (Attr * I64) (Attr b (List (Attr Shared (Num (Attr Shared a))))) ])",
"partitionHelp" => "Attr Shared (Attr b Int, Attr Shared Int, Attr c (List (Attr Shared (Num (Attr Shared a)))), Attr Shared Int, Attr Shared (Num (Attr Shared a)) -> Attr * [ Pair (Attr b Int) (Attr c (List (Attr Shared (Num (Attr Shared a))))) ])", "partitionHelp" => "Attr Shared (Attr b I64, Attr Shared I64, Attr c (List (Attr Shared (Num (Attr Shared a)))), Attr Shared I64, Attr Shared (Num (Attr Shared a)) -> Attr * [ Pair (Attr b I64) (Attr c (List (Attr Shared (Num (Attr Shared a))))) ])",
"quicksort" => "Attr Shared (Attr b (List (Attr Shared (Num (Attr Shared a)))), Attr Shared Int, Attr Shared Int -> Attr b (List (Attr Shared (Num (Attr Shared a)))))", "quicksort" => "Attr Shared (Attr b (List (Attr Shared (Num (Attr Shared a)))), Attr Shared I64, Attr Shared I64 -> Attr b (List (Attr Shared (Num (Attr Shared a)))))",
}, },
); );
} }

View file

@ -742,7 +742,7 @@ define_builtins! {
1 NUM: "Num" => { 1 NUM: "Num" => {
0 NUM_NUM: "Num" imported // the Num.Num type alias 0 NUM_NUM: "Num" imported // the Num.Num type alias
1 NUM_AT_NUM: "@Num" // the Num.@Num private tag 1 NUM_AT_NUM: "@Num" // the Num.@Num private tag
2 NUM_INT: "Int" imported // the Int.Int type alias 2 NUM_I64: "I64" imported // the Num.I64 type alias
3 NUM_INTEGER: "Integer" imported // Int : Num Integer 3 NUM_INTEGER: "Integer" imported // Int : Num Integer
4 NUM_AT_INTEGER: "@Integer" // the Int.@Integer private tag 4 NUM_AT_INTEGER: "@Integer" // the Int.@Integer private tag
5 NUM_F64: "F64" imported // the Num.F64 type alias 5 NUM_F64: "F64" imported // the Num.F64 type alias

View file

@ -323,7 +323,7 @@ impl<'a> Layout<'a> {
} }
Structure(flat_type) => layout_from_flat_type(env, flat_type), Structure(flat_type) => layout_from_flat_type(env, flat_type),
Alias(Symbol::NUM_INT, args, _) => { Alias(Symbol::NUM_I64, args, _) => {
debug_assert!(args.is_empty()); debug_assert!(args.is_empty());
Ok(Layout::Builtin(Builtin::Int64)) Ok(Layout::Builtin(Builtin::Int64))
} }
@ -723,7 +723,7 @@ fn layout_from_flat_type<'a>(
match flat_type { match flat_type {
Apply(symbol, args) => { Apply(symbol, args) => {
match symbol { match symbol {
Symbol::NUM_INT => { Symbol::NUM_I64 => {
debug_assert_eq!(args.len(), 0); debug_assert_eq!(args.len(), 0);
Ok(Layout::Builtin(Builtin::Int64)) Ok(Layout::Builtin(Builtin::Int64))
} }

View file

@ -375,7 +375,7 @@ mod test_mono {
fn ir_when_just() { fn ir_when_just() {
compiles_to_ir( compiles_to_ir(
r#" r#"
x : [ Nothing, Just Int ] x : [ Nothing, Just I64 ]
x = Just 41 x = Just 41
when x is when x is
@ -412,7 +412,7 @@ mod test_mono {
fn one_element_tag() { fn one_element_tag() {
compiles_to_ir( compiles_to_ir(
r#" r#"
x : [ Pair Int ] x : [ Pair I64 ]
x = Pair 2 x = Pair 2
x x
@ -502,7 +502,7 @@ mod test_mono {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just (Just 41) x = Just (Just 41)
when x is when x is
@ -795,7 +795,7 @@ mod test_mono {
compiles_to_ir( compiles_to_ir(
r#" r#"
wrapper = \{} -> wrapper = \{} ->
x : Result Int Int x : Result I64 I64
x = Ok 2 x = Ok 2
y = y =
@ -1002,10 +1002,10 @@ mod test_mono {
compiles_to_ir( compiles_to_ir(
indoc!( indoc!(
r#" r#"
x : List Int x : List I64
x = [1,2,3] x = [1,2,3]
id : List Int -> List Int id : List I64 -> List I64
id = \y -> List.set y 0 0 id = \y -> List.set y 0 0
id x id x
@ -1185,7 +1185,7 @@ mod test_mono {
compiles_to_ir( compiles_to_ir(
indoc!( indoc!(
r#" r#"
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
(Pair partitionIndex partitioned) = Pair 0 [] (Pair partitionIndex partitioned) = Pair 0 []
@ -1376,7 +1376,7 @@ mod test_mono {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -1412,7 +1412,7 @@ mod test_mono {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
(Pair partitionIndex partitioned) = partition low high list (Pair partitionIndex partitioned) = partition low high list
@ -1424,7 +1424,7 @@ mod test_mono {
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1435,7 +1435,7 @@ mod test_mono {
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -1447,7 +1447,7 @@ mod test_mono {
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -1690,10 +1690,10 @@ mod test_mono {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
x : List Int x : List I64
x = [1,2,3] x = [1,2,3]
add : List Int -> List Int add : List I64 -> List I64
add = \y -> List.set y 0 0 add = \y -> List.set y 0 0
main = main =
@ -1992,7 +1992,7 @@ mod test_mono {
r#" r#"
Maybe a : [ Nothing, Just a ] Maybe a : [ Nothing, Just a ]
x : Maybe (Maybe Int) x : Maybe (Maybe I64)
x = Just (Just 41) x = Just (Just 41)
when x is when x is
@ -2047,10 +2047,10 @@ mod test_mono {
r#" r#"
LinkedList a : [ Nil, Cons a (LinkedList a) ] LinkedList a : [ Nil, Cons a (LinkedList a) ]
nil : LinkedList Int nil : LinkedList I64
nil = Nil nil = Nil
length : LinkedList a -> Int length : LinkedList a -> I64
length = \list -> length = \list ->
when list is when list is
Nil -> 0 Nil -> 0
@ -2102,7 +2102,7 @@ mod test_mono {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->

View file

@ -1608,8 +1608,8 @@ fn to_diff<'b>(
let right = to_doc(alloc, Parens::Unnecessary, type2); let right = to_doc(alloc, Parens::Unnecessary, type2);
let is_int = |t: &ErrorType| match t { let is_int = |t: &ErrorType| match t {
ErrorType::Type(Symbol::NUM_INT, _) => true, ErrorType::Type(Symbol::NUM_I64, _) => true,
ErrorType::Alias(Symbol::NUM_INT, _, _) => true, ErrorType::Alias(Symbol::NUM_I64, _, _) => true,
ErrorType::Type(Symbol::NUM_NUM, args) => match &args.get(0) { ErrorType::Type(Symbol::NUM_NUM, args) => match &args.get(0) {
Some(ErrorType::Type(Symbol::NUM_INTEGER, _)) => true, Some(ErrorType::Type(Symbol::NUM_INTEGER, _)) => true,

View file

@ -623,7 +623,7 @@ mod test_reporting {
Num Num
Set Set
Result Result
Int F64
"# "#
), ),
); );
@ -634,7 +634,7 @@ mod test_reporting {
// report_problem_as( // report_problem_as(
// indoc!( // indoc!(
// r#" // r#"
// foo : Int as Int // foo : I64 as I64
// foo = 42 // foo = 42
// //
// foo // foo
@ -657,7 +657,7 @@ mod test_reporting {
// report_problem_as( // report_problem_as(
// indoc!( // indoc!(
// r#" // r#"
// foo : Int as a // foo : I64 as a
// foo = 42 // foo = 42
// //
// foo // foo
@ -961,7 +961,7 @@ mod test_reporting {
r#" r#"
bar = { bar : 0x3 } bar = { bar : 0x3 }
f : { foo : Int } -> Bool f : { foo : I64 } -> Bool
f = \_ -> True f = \_ -> True
f bar f bar
@ -978,11 +978,11 @@ mod test_reporting {
This `bar` value is a: This `bar` value is a:
{ bar : Int } { bar : I64 }
But `f` needs the 1st argument to be: But `f` needs the 1st argument to be:
{ foo : Int } { foo : I64 }
Tip: Seems like a record field typo. Maybe `bar` should be `foo`? Tip: Seems like a record field typo. Maybe `bar` should be `foo`?
@ -1037,7 +1037,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : [ Red Int, Green Bool ] -> Bool f : [ Red I64, Green Bool ] -> Bool
f = \_ -> True f = \_ -> True
f (Blue 3.14) f (Blue 3.14)
@ -1058,7 +1058,7 @@ mod test_reporting {
But `f` needs the 1st argument to be: But `f` needs the 1st argument to be:
[ Green Bool, Red Int ] [ Green Bool, Red I64 ]
Tip: Seems like a tag typo. Maybe `Blue` should be `Red`? Tip: Seems like a tag typo. Maybe `Blue` should be `Red`?
@ -1075,7 +1075,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : Int x : I64
x = if True then 3.14 else 4 x = if True then 3.14 else 4
x x
@ -1096,7 +1096,7 @@ mod test_reporting {
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
Int I64
Tip: You can convert between Int and Float using functions like Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`. `Num.toFloat` and `Num.round`.
@ -1110,7 +1110,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : Int x : I64
x = x =
when True is when True is
_ -> 3.14 _ -> 3.14
@ -1124,7 +1124,7 @@ mod test_reporting {
Something is off with the body of the `x` definition: Something is off with the body of the `x` definition:
1 x : Int 1 x : I64
2 x = 2 x =
3> when True is 3> when True is
4> _ -> 3.14 4> _ -> 3.14
@ -1135,7 +1135,7 @@ mod test_reporting {
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
Int I64
Tip: You can convert between Int and Float using functions like Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`. `Num.toFloat` and `Num.round`.
@ -1149,7 +1149,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : Int -> Int x : I64 -> I64
x = \_ -> 3.14 x = \_ -> 3.14
x x
@ -1161,7 +1161,7 @@ mod test_reporting {
Something is off with the body of the `x` definition: Something is off with the body of the `x` definition:
1 x : Int -> Int 1 x : I64 -> I64
2 x = \_ -> 3.14 2 x = \_ -> 3.14
^^^^ ^^^^
@ -1171,7 +1171,7 @@ mod test_reporting {
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
Int I64
Tip: You can convert between Int and Float using functions like Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`. `Num.toFloat` and `Num.round`.
@ -1185,7 +1185,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : Int x : I64
x = 42 x = 42
x 3 x 3
@ -1211,7 +1211,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : Int -> Int f : I64 -> I64
f = \_ -> 42 f = \_ -> 42
f 1 2 f 1 2
@ -1237,7 +1237,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : Int, Int -> Int f : I64, I64 -> I64
f = \_, _ -> 42 f = \_, _ -> 42
f 1 f 1
@ -1372,9 +1372,9 @@ mod test_reporting {
these names seem close though: these names seem close though:
Bool Bool
Int
F64 F64
Num Num
Map
"# "#
), ),
) )
@ -1483,7 +1483,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
{ x } : { x : Int } { x } : { x : I64 }
{ x } = { x: 4.0 } { x } = { x: 4.0 }
x x
@ -1495,7 +1495,7 @@ mod test_reporting {
Something is off with the body of this definition: Something is off with the body of this definition:
1 { x } : { x : Int } 1 { x } : { x : I64 }
2 { x } = { x: 4.0 } 2 { x } = { x: 4.0 }
^^^^^^^^^^ ^^^^^^^^^^
@ -1505,7 +1505,7 @@ mod test_reporting {
But the type annotation says it should be: But the type annotation says it should be:
{ x : Int } { x : I64 }
Tip: You can convert between Int and Float using functions like Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`. `Num.toFloat` and `Num.round`.
@ -1644,7 +1644,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : { a : Int, b : F64, c : Bool } x : { a : I64, b : F64, c : Bool }
x = { b: 4.0 } x = { b: 4.0 }
x x
@ -1656,7 +1656,7 @@ mod test_reporting {
Something is off with the body of the `x` definition: Something is off with the body of the `x` definition:
1 x : { a : Int, b : F64, c : Bool } 1 x : { a : I64, b : F64, c : Bool }
2 x = { b: 4.0 } 2 x = { b: 4.0 }
^^^^^^^^^^ ^^^^^^^^^^
@ -1666,7 +1666,7 @@ mod test_reporting {
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
{ a : Int, b : F64, c : Bool } { a : I64, b : F64, c : Bool }
Tip: Looks like the c and a fields are missing. Tip: Looks like the c and a fields are missing.
"# "#
@ -1788,7 +1788,7 @@ mod test_reporting {
The body is an integer of type: The body is an integer of type:
Int I64
But the type annotation on `f` says it should be: But the type annotation on `f` says it should be:
@ -1796,7 +1796,7 @@ mod test_reporting {
Tip: The type annotation uses the type variable `msg` to say that this Tip: The type annotation uses the type variable `msg` to say that this
definition can produce any type of value. But in the body I see that definition can produce any type of value. But in the body I see that
it will only produce a `Int` value of a single specific type. Maybe it will only produce a `I64` value of a single specific type. Maybe
change the type annotation to be more specific? Maybe change the code change the type annotation to be more specific? Maybe change the code
to be more general? to be more general?
"# "#
@ -1810,7 +1810,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : Bool -> [ Ok Int, InvalidFoo ] f : Bool -> [ Ok I64, InvalidFoo ]
f = \_ -> ok 4 f = \_ -> ok 4
f f
@ -1828,9 +1828,9 @@ mod test_reporting {
these names seem close though: these names seem close though:
f f
Int
F64 F64
Num Num
Map
"# "#
), ),
) )
@ -1842,7 +1842,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : Bool -> Int f : Bool -> I64
f = \_ -> f = \_ ->
ok = 3 ok = 3
@ -1867,7 +1867,7 @@ mod test_reporting {
Something is off with the body of the `f` definition: Something is off with the body of the `f` definition:
1 f : Bool -> Int 1 f : Bool -> I64
2 f = \_ -> 2 f = \_ ->
3 ok = 3 3 ok = 3
4 4
@ -1880,7 +1880,7 @@ mod test_reporting {
But the type annotation on `f` says it should be: But the type annotation on `f` says it should be:
Int I64
"# "#
), ),
) )
@ -2005,7 +2005,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { fo: Int }ext -> Int f : { fo: I64 }ext -> I64
f = \r -> f = \r ->
r2 = { r & foo: r.fo } r2 = { r & foo: r.fo }
@ -2026,7 +2026,7 @@ mod test_reporting {
This is usually a typo. Here are the `r` fields that are most similar: This is usually a typo. Here are the `r` fields that are most similar:
{ fo : Int { fo : I64
}ext }ext
So maybe `.foo` should be `.fo`? So maybe `.foo` should be `.fo`?
@ -2259,12 +2259,12 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
Either : [ Left Int, Right Bool ] Either : [ Left I64, Right Bool ]
x : Either x : Either
x = Left 42 x = Left 42
f : Either -> Int f : Either -> I64
f = \Left v -> v f = \Left v -> v
f x f x
@ -2296,7 +2296,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : [ Left Int, Right Bool ] x : [ Left I64, Right Bool ]
x = Left 42 x = Left 42
@ -2425,7 +2425,7 @@ mod test_reporting {
r#" r#"
RemoteData e a : [ NotAsked, Loading, Failure e, Success a ] RemoteData e a : [ NotAsked, Loading, Failure e, Success a ]
x : RemoteData Int Str x : RemoteData I64 Str
when x is when x is
NotAsked -> 3 NotAsked -> 3
@ -2488,7 +2488,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
y : [ Nothing, Just Int ] y : [ Nothing, Just I64 ]
y = Just 4 y = Just 4
x = { a: y, b: 42} x = { a: y, b: 42}
@ -2581,9 +2581,9 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
Foo : { x : Int } Foo : { x : I64 }
f : Foo -> Int f : Foo -> I64
f = \r -> r.x f = \r -> r.x
f { y: 3.14 } f { y: 3.14 }
@ -2605,7 +2605,7 @@ mod test_reporting {
But `f` needs the 1st argument to be: But `f` needs the 1st argument to be:
{ x : Int } { x : I64 }
Tip: Seems like a record field typo. Maybe `y` should be `x`? Tip: Seems like a record field typo. Maybe `y` should be `x`?
@ -2835,7 +2835,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
a : { foo : Int, bar : F64, foo : Str } a : { foo : I64, bar : F64, foo : Str }
a = { bar: 3.0, foo: "foo" } a = { bar: 3.0, foo: "foo" }
a a
@ -2847,12 +2847,12 @@ mod test_reporting {
This record type defines the `.foo` field twice! This record type defines the `.foo` field twice!
1 a : { foo : Int, bar : F64, foo : Str } 1 a : { foo : I64, bar : F64, foo : Str }
^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^
In the rest of the program, I will only use the latter definition: In the rest of the program, I will only use the latter definition:
1 a : { foo : Int, bar : F64, foo : Str } 1 a : { foo : I64, bar : F64, foo : Str }
^^^^^^^^^ ^^^^^^^^^
For clarity, remove the previous `.foo` definitions from this record For clarity, remove the previous `.foo` definitions from this record
@ -2867,7 +2867,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
a : [ Foo Int, Bar F64, Foo Str ] a : [ Foo I64, Bar F64, Foo Str ]
a = Foo "foo" a = Foo "foo"
a a
@ -2879,12 +2879,12 @@ mod test_reporting {
This tag union type defines the `Foo` tag twice! This tag union type defines the `Foo` tag twice!
1 a : [ Foo Int, Bar F64, Foo Str ] 1 a : [ Foo I64, Bar F64, Foo Str ]
^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^^^
In the rest of the program, I will only use the latter definition: In the rest of the program, I will only use the latter definition:
1 a : [ Foo Int, Bar F64, Foo Str ] 1 a : [ Foo I64, Bar F64, Foo Str ]
^^^^^^^ ^^^^^^^
For clarity, remove the previous `Foo` definitions from this tag union For clarity, remove the previous `Foo` definitions from this tag union
@ -2899,7 +2899,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
bar : Int bar : I64
foo = \x -> x foo = \x -> x
# NOTE: neither bar or foo are defined at this point # NOTE: neither bar or foo are defined at this point
@ -2913,7 +2913,7 @@ mod test_reporting {
This annotation does not match the definition immediately following This annotation does not match the definition immediately following
it: it:
1> bar : Int 1> bar : I64
2> foo = \x -> x 2> foo = \x -> x
Is it a typo? If not, put either a newline or comment between them. Is it a typo? If not, put either a newline or comment between them.
@ -2927,7 +2927,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
bar : Int bar : I64
foo = \x -> x foo = \x -> x
@ -2943,7 +2943,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
MyAlias 1 : Int MyAlias 1 : I64
4 4
"# "#
@ -2954,7 +2954,7 @@ mod test_reporting {
This pattern in the definition of `MyAlias` is not what I expect: This pattern in the definition of `MyAlias` is not what I expect:
1 MyAlias 1 : Int 1 MyAlias 1 : I64
^ ^
Only type variables like `a` or `value` can occur in this position. Only type variables like `a` or `value` can occur in this position.
@ -2963,7 +2963,7 @@ mod test_reporting {
`MyAlias` is not used anywhere in your code. `MyAlias` is not used anywhere in your code.
1 MyAlias 1 : Int 1 MyAlias 1 : I64
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
If you didn't intend on using `MyAlias` then remove it so future readers If you didn't intend on using `MyAlias` then remove it so future readers
@ -2978,7 +2978,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
a : Num Int F64 a : Num I64 F64
a = 3 a = 3
a a
@ -2990,7 +2990,7 @@ mod test_reporting {
The `Num` alias expects 1 type argument, but it got 2 instead: The `Num` alias expects 1 type argument, but it got 2 instead:
1 a : Num Int F64 1 a : Num I64 F64
^^^^^^^^^^^ ^^^^^^^^^^^
Are there missing parentheses? Are there missing parentheses?
@ -3004,7 +3004,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : Bool -> Num Int F64 f : Bool -> Num I64 F64
f = \_ -> 3 f = \_ -> 3
f f
@ -3016,7 +3016,7 @@ mod test_reporting {
The `Num` alias expects 1 type argument, but it got 2 instead: The `Num` alias expects 1 type argument, but it got 2 instead:
1 f : Bool -> Num Int F64 1 f : Bool -> Num I64 F64
^^^^^^^^^^^ ^^^^^^^^^^^
Are there missing parentheses? Are there missing parentheses?
@ -3032,7 +3032,7 @@ mod test_reporting {
r#" r#"
Pair a b : [ Pair a b ] Pair a b : [ Pair a b ]
x : Pair Int x : Pair I64
x = Pair 2 3 x = Pair 2 3
x x
@ -3044,7 +3044,7 @@ mod test_reporting {
The `Pair` alias expects 2 type arguments, but it got 1 instead: The `Pair` alias expects 2 type arguments, but it got 1 instead:
3 x : Pair Int 3 x : Pair I64
^^^^^^^^ ^^^^^^^^
Are there missing parentheses? Are there missing parentheses?
@ -3060,7 +3060,7 @@ mod test_reporting {
r#" r#"
Pair a b : [ Pair a b ] Pair a b : [ Pair a b ]
x : Pair Int Int Int x : Pair I64 I64 I64
x = 3 x = 3
x x
@ -3072,7 +3072,7 @@ mod test_reporting {
The `Pair` alias expects 2 type arguments, but it got 3 instead: The `Pair` alias expects 2 type arguments, but it got 3 instead:
3 x : Pair Int Int Int 3 x : Pair I64 I64 I64
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
Are there missing parentheses? Are there missing parentheses?
@ -3088,7 +3088,7 @@ mod test_reporting {
r#" r#"
Foo a : [ Foo ] Foo a : [ Foo ]
f : Foo Int f : Foo I64
f f
"# "#
@ -3176,7 +3176,7 @@ mod test_reporting {
AList a b : [ ACons a (BList a b), ANil ] AList a b : [ ACons a (BList a b), ANil ]
BList a b : [ BCons a (AList a b), BNil ] BList a b : [ BCons a (AList a b), BNil ]
x : AList Int Int x : AList I64 I64
x = ACons 0 (BCons 1 (ACons "foo" BNil )) x = ACons 0 (BCons 1 (ACons "foo" BNil ))
y : BList a a y : BList a a
@ -3191,19 +3191,19 @@ mod test_reporting {
Something is off with the body of the `x` definition: Something is off with the body of the `x` definition:
4 x : AList Int Int 4 x : AList I64 I64
5 x = ACons 0 (BCons 1 (ACons "foo" BNil )) 5 x = ACons 0 (BCons 1 (ACons "foo" BNil ))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This `ACons` global tag application has the type: This `ACons` global tag application has the type:
[ ACons (Num Integer) [ BCons (Num Integer) [ ACons Str [ [ ACons (Num Integer) [ BCons (Num Integer) [ ACons Str [
BCons Int [ ACons Int (BList Int Int), ANil ] as a, BNil ], ANil BCons I64 [ ACons I64 (BList I64 I64), ANil ] as a, BNil ], ANil
], BNil ], ANil ] ], BNil ], ANil ]
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
[ ACons Int (BList Int Int), ANil ] as a [ ACons I64 (BList I64 I64), ANil ] as a
"# "#
), ),
) )
@ -3575,7 +3575,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \{ x, y ? "foo" } -> (\g, _ -> g) x y f = \{ x, y ? "foo" } -> (\g, _ -> g) x y
f f
@ -3592,11 +3592,11 @@ mod test_reporting {
The argument is a pattern that matches record values of type: The argument is a pattern that matches record values of type:
{ x : Int, y ? Str } { x : I64, y ? Str }
But the annotation on `f` says the 1st argument should be: But the annotation on `f` says the 1st argument should be:
{ x : Int, y ? Int } { x : I64, y ? I64 }
"# "#
), ),
) )
@ -3608,7 +3608,7 @@ mod test_reporting {
indoc!( indoc!(
r#" r#"
\rec -> \rec ->
{ x, y } : { x : Int, y ? Bool } { x, y } : { x : I64, y ? Bool }
{ x, y } = rec { x, y } = rec
{ x, y } { x, y }
@ -3620,16 +3620,16 @@ mod test_reporting {
Something is off with the body of this definition: Something is off with the body of this definition:
2> { x, y } : { x : Int, y ? Bool } 2> { x, y } : { x : I64, y ? Bool }
3> { x, y } = rec 3> { x, y } = rec
The body is a value of type: The body is a value of type:
{ x : Int, y : Bool } { x : I64, y : Bool }
But the type annotation says it should be: But the type annotation says it should be:
{ x : Int, y ? Bool } { x : I64, y ? Bool }
Tip: To extract the `.y` field it must be non-optional, but the type Tip: To extract the `.y` field it must be non-optional, but the type
says this field is optional. Learn more about optional fields at TODO. says this field is optional. Learn more about optional fields at TODO.
@ -3643,7 +3643,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \{ x, y } -> x + y f = \{ x, y } -> x + y
f f
@ -3660,11 +3660,11 @@ mod test_reporting {
The argument is a pattern that matches record values of type: The argument is a pattern that matches record values of type:
{ x : Int, y : Int } { x : I64, y : I64 }
But the annotation on `f` says the 1st argument should be: But the annotation on `f` says the 1st argument should be:
{ x : Int, y ? Int } { x : I64, y ? I64 }
Tip: To extract the `.y` field it must be non-optional, but the type Tip: To extract the `.y` field it must be non-optional, but the type
says this field is optional. Learn more about optional fields at TODO. says this field is optional. Learn more about optional fields at TODO.
@ -3678,7 +3678,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \r -> f = \r ->
when r is when r is
{ x, y } -> x + y { x, y } -> x + y
@ -3697,11 +3697,11 @@ mod test_reporting {
The first pattern is trying to match record values of type: The first pattern is trying to match record values of type:
{ x : Int, y : Int } { x : I64, y : I64 }
But the expression between `when` and `is` has the type: But the expression between `when` and `is` has the type:
{ x : Int, y ? Int } { x : I64, y ? I64 }
Tip: To extract the `.y` field it must be non-optional, but the type Tip: To extract the `.y` field it must be non-optional, but the type
says this field is optional. Learn more about optional fields at TODO. says this field is optional. Learn more about optional fields at TODO.
@ -3715,7 +3715,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \r -> r.y f = \r -> r.y
f f
@ -3732,11 +3732,11 @@ mod test_reporting {
This `r` value is a: This `r` value is a:
{ x : Int, y ? Int } { x : I64, y ? I64 }
But you are trying to use it as: But you are trying to use it as:
{ x : Int, y : Int } { x : I64, y : I64 }
Tip: To extract the `.y` field it must be non-optional, but the type Tip: To extract the `.y` field it must be non-optional, but the type
says this field is optional. Learn more about optional fields at TODO. says this field is optional. Learn more about optional fields at TODO.
@ -3750,7 +3750,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \r -> .y r f = \r -> .y r
f f
@ -3767,11 +3767,11 @@ mod test_reporting {
This `r` value is a: This `r` value is a:
{ x : Int, y ? Int } { x : I64, y ? I64 }
But this function needs the 1st argument to be: But this function needs the 1st argument to be:
{ x : Int, y : Int } { x : I64, y : I64 }
Tip: To extract the `.y` field it must be non-optional, but the type Tip: To extract the `.y` field it must be non-optional, but the type
says this field is optional. Learn more about optional fields at TODO. says this field is optional. Learn more about optional fields at TODO.
@ -3785,7 +3785,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y : Int } -> Int f : { x : I64, y : I64 } -> I64
f = \r -> f = \r ->
when r is when r is
{ x, y : "foo" } -> x + 0 { x, y : "foo" } -> x + 0
@ -3805,11 +3805,11 @@ mod test_reporting {
The first pattern is trying to match record values of type: The first pattern is trying to match record values of type:
{ x : Int, y : Str } { x : I64, y : Str }
But the expression between `when` and `is` has the type: But the expression between `when` and `is` has the type:
{ x : Int, y : Int } { x : I64, y : I64 }
"# "#
), ),
) )
@ -3820,7 +3820,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
f : { x : Int, y ? Int } -> Int f : { x : I64, y ? I64 } -> I64
f = \r -> f = \r ->
when r is when r is
{ x, y ? "foo" } -> (\g, _ -> g) x y { x, y ? "foo" } -> (\g, _ -> g) x y
@ -3840,11 +3840,11 @@ mod test_reporting {
The first pattern is trying to match record values of type: The first pattern is trying to match record values of type:
{ x : Int, y ? Str } { x : I64, y ? Str }
But the expression between `when` and `is` has the type: But the expression between `when` and `is` has the type:
{ x : Int, y ? Int } { x : I64, y ? I64 }
"# "#
), ),
) )

View file

@ -1326,12 +1326,12 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
int : Int int : I64
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1345,7 +1345,7 @@ mod solve_expr {
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1354,13 +1354,13 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
int : Int int : I64
int = 5 int = 5
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1369,13 +1369,13 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
int : Num.Int int : Num.I64
int = 5 int = 5
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1390,7 +1390,7 @@ mod solve_expr {
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1405,7 +1405,7 @@ mod solve_expr {
int int
"# "#
), ),
"Int", "I64",
); );
} }
@ -1489,13 +1489,13 @@ mod solve_expr {
r#" r#"
Res a e : [ Okay a, Error e ] Res a e : [ Okay a, Error e ]
ok : Res Int * ok : Res I64 *
ok = Okay 5 ok = Okay 5
ok ok
"# "#
), ),
"Res Int *", "Res I64 *",
); );
} }
@ -1521,13 +1521,13 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
ok : Result Int * ok : Result I64 *
ok = Ok 5 ok = Ok 5
ok ok
"# "#
), ),
"Result Int *", "Result I64 *",
); );
} }
@ -1551,7 +1551,7 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
ok : Result Int * ok : Result I64 *
ok = Ok 5 ok = Ok 5
err : Result * Str err : Result * Str
@ -1563,7 +1563,7 @@ mod solve_expr {
err err
"# "#
), ),
"Result Int Str", "Result I64 Str",
); );
} }
@ -1584,19 +1584,19 @@ mod solve_expr {
// #[test] // #[test]
// fn annotation_using_num_used() { // fn annotation_using_num_used() {
// // There was a problem where `Int`, because it is only an annotation // // There was a problem where `I64`, because it is only an annotation
// // wasn't added to the vars_by_symbol. // // wasn't added to the vars_by_symbol.
// infer_eq_without_problem( // infer_eq_without_problem(
// indoc!( // indoc!(
// r#" // r#"
// int : Int // int : I64
// p = (\x -> x) int // p = (\x -> x) int
// p // p
// "# // "#
// ), // ),
// "Int", // "I64",
// ); // );
// } // }
@ -1631,7 +1631,7 @@ mod solve_expr {
x x
"# "#
), ),
"Int", "I64",
); );
} }
@ -1840,7 +1840,7 @@ mod solve_expr {
v v
"# "#
), ),
"Foo Int", "Foo I64",
); );
} }
@ -1907,7 +1907,7 @@ mod solve_expr {
length length
"# "#
), ),
"Peano -> Int", "Peano -> I64",
); );
} }
@ -2253,13 +2253,13 @@ mod solve_expr {
// infer_eq_without_problem( // infer_eq_without_problem(
// indoc!( // indoc!(
// r#" // r#"
// UserId x : [ UserId Int ] // UserId x : [ UserId I64 ]
// UserId x = UserId 42 // UserId x = UserId 42
// x // x
// "# // "#
// ), // ),
// "Int", // "I64",
// ); // );
// } // }
@ -2340,13 +2340,13 @@ mod solve_expr {
ListB a : [ Cons a (ListC a) ] ListB a : [ Cons a (ListC a) ]
ListC a : [ Cons a (ListA a), Nil ] ListC a : [ Cons a (ListA a), Nil ]
val : ListC Num.Int val : ListC Num.I64
val = Cons 1 (Cons 2 (Cons 3 Nil)) val = Cons 1 (Cons 2 (Cons 3 Nil))
val val
"# "#
), ),
"ListC Int", "ListC I64",
); );
} }
@ -2388,7 +2388,7 @@ mod solve_expr {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
partition : Int, Int, List Int -> [ Pair Int (List Int) ] partition : I64, I64, List I64 -> [ Pair I64 (List I64) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok _ -> Ok _ ->
@ -2400,7 +2400,7 @@ mod solve_expr {
partition partition
"# "#
), ),
"Int, Int, List Int -> [ Pair Int (List Int) ]", "I64, I64, List I64 -> [ Pair I64 (List I64) ]",
); );
} }
@ -2410,7 +2410,7 @@ mod solve_expr {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -2421,7 +2421,7 @@ mod solve_expr {
_ -> _ ->
list list
partition : Int, Int, List Int -> [ Pair Int (List Int) ] partition : I64, I64, List I64 -> [ Pair I64 (List I64) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -2449,7 +2449,7 @@ mod solve_expr {
partition partition
"# "#
), ),
"Int, Int, List Int -> [ Pair Int (List Int) ]", "I64, I64, List I64 -> [ Pair I64 (List I64) ]",
); );
}); });
} }
@ -2462,14 +2462,14 @@ mod solve_expr {
idList : List a -> List a idList : List a -> List a
idList = \list -> list idList = \list -> list
foo : List Int -> List Int foo : List I64 -> List I64
foo = \initialList -> idList initialList foo = \initialList -> idList initialList
foo foo
"# "#
), ),
"List Int -> List Int", "List I64 -> List I64",
); );
} }
@ -2547,7 +2547,7 @@ mod solve_expr {
Num.ceiling Num.ceiling
"# "#
), ),
"F64 -> Int", "F64 -> I64",
); );
} }
@ -2559,7 +2559,7 @@ mod solve_expr {
Num.floor Num.floor
"# "#
), ),
"F64 -> Int", "F64 -> I64",
); );
} }
@ -2571,7 +2571,7 @@ mod solve_expr {
Num.powInt Num.powInt
"# "#
), ),
"Int, Int -> Int", "I64, I64 -> I64",
); );
} }
@ -2789,15 +2789,15 @@ mod solve_expr {
#[should_panic] #[should_panic]
fn rigid_record_quantification() { fn rigid_record_quantification() {
// the ext here is qualified on the outside (because we have rank 1 types, not rank 2). // the ext here is qualified on the outside (because we have rank 1 types, not rank 2).
// That means e.g. `f : { bar : String, foo : Int } -> Bool }` is a valid argument, but // That means e.g. `f : { bar : String, foo : I64 } -> Bool }` is a valid argument, but
// that function could not be applied to the `{ foo : Int }` list. Therefore, this function // that function could not be applied to the `{ foo : I64 }` list. Therefore, this function
// is not allowed. // is not allowed.
// //
// should hit a debug_assert! in debug mode, and produce a type error in release mode // should hit a debug_assert! in debug mode, and produce a type error in release mode
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
test : ({ foo : Int }ext -> Bool), { foo : Int } -> Bool test : ({ foo : I64 }ext -> Bool), { foo : I64 } -> Bool
test = \fn, a -> fn a test = \fn, a -> fn a
test test
@ -2814,12 +2814,12 @@ mod solve_expr {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
negatePoint : { x : Int, y : Int, z ? Num c } -> { x : Int, y : Int, z : Num c } negatePoint : { x : I64, y : I64, z ? Num c } -> { x : I64, y : I64, z : Num c }
negatePoint { x: 1, y: 2 } negatePoint { x: 1, y: 2 }
"# "#
), ),
"{ x : Int, y : Int, z : Num c }", "{ x : I64, y : I64, z : Num c }",
); );
} }
@ -2828,7 +2828,7 @@ mod solve_expr {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
negatePoint : { x : Int, y : Int, z ? Num c }r -> { x : Int, y : Int, z : Num c }r negatePoint : { x : I64, y : I64, z ? Num c }r -> { x : I64, y : I64, z : Num c }r
a = negatePoint { x: 1, y: 2 } a = negatePoint { x: 1, y: 2 }
b = negatePoint { x: 1, y: 2, blah : "hi" } b = negatePoint { x: 1, y: 2, blah : "hi" }
@ -2836,7 +2836,7 @@ mod solve_expr {
{ a, b } { a, b }
"# "#
), ),
"{ a : { x : Int, y : Int, z : Num c }, b : { blah : Str, x : Int, y : Int, z : Num c } }", "{ a : { x : I64, y : I64, z : Num c }, b : { blah : Str, x : I64, y : I64, z : Num c } }",
); );
} }
@ -2850,7 +2850,7 @@ mod solve_expr {
negatePoint { x: 1, y: 2.1, z: 0x3 } negatePoint { x: 1, y: 2.1, z: 0x3 }
"# "#
), ),
"{ x : Num a, y : F64, z : Int }", "{ x : Num a, y : F64, z : I64 }",
); );
} }
@ -2917,13 +2917,13 @@ mod solve_expr {
indoc!( indoc!(
r#" r#"
\rec -> \rec ->
{ x, y } : { x : Int, y ? Bool }* { x, y } : { x : I64, y ? Bool }*
{ x, y ? False } = rec { x, y ? False } = rec
{ x, y } { x, y }
"# "#
), ),
"{ x : Int, y ? Bool }* -> { x : Int, y : Bool }", "{ x : I64, y ? Bool }* -> { x : I64, y : Bool }",
); );
} }
@ -2944,14 +2944,14 @@ mod solve_expr {
infer_eq_without_problem( infer_eq_without_problem(
indoc!( indoc!(
r#" r#"
empty : List Int empty : List I64
empty = empty =
[] []
List.walkBackwards empty (\a, b -> a + b) 0 List.walkBackwards empty (\a, b -> a + b) 0
"# "#
), ),
"Int", "I64",
); );
} }
@ -2970,7 +2970,7 @@ mod solve_expr {
g g
"# "#
), ),
"Int", "I64",
); );
} }
@ -3023,7 +3023,7 @@ mod solve_expr {
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
Bar : [ Bar ] Bar : [ Bar ]
Foo : [ Foo Bar Int, Empty ] Foo : [ Foo Bar I64, Empty ]
foo : Foo foo : Foo
foo = Foo Bar 1 foo = Foo Bar 1
@ -3037,7 +3037,7 @@ mod solve_expr {
x x
"# "#
), ),
"[ Empty, Foo [ Bar ] Int ]", "[ Empty, Foo [ Bar ] I64 ]",
); );
} }
@ -3048,7 +3048,7 @@ mod solve_expr {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
Foo : [ @Foo [ @Bar ] Int, @Empty ] Foo : [ @Foo [ @Bar ] I64, @Empty ]
foo : Foo foo : Foo
foo = @Foo @Bar 1 foo = @Foo @Bar 1
@ -3062,7 +3062,7 @@ mod solve_expr {
x x
"# "#
), ),
"[ @Empty, @Foo [ @Bar ] Int ]", "[ @Empty, @Foo [ @Bar ] I64 ]",
); );
} }
@ -3073,21 +3073,21 @@ mod solve_expr {
r#" r#"
app "test" provides [ main ] to "./platform" app "test" provides [ main ] to "./platform"
State a : { count : Int, x : a } State a : { count : I64, x : a }
foo : State a -> Int foo : State a -> I64
foo = \state -> foo = \state ->
if state.count == 0 then if state.count == 0 then
0 0
else else
1 + foo { count: state.count - 1, x: state.x } 1 + foo { count: state.count - 1, x: state.x }
main : Int main : I64
main = main =
foo { count: 3, x: {} } foo { count: 3, x: {} }
"# "#
), ),
"Int", "I64",
); );
} }
@ -3108,15 +3108,15 @@ mod solve_expr {
empty = empty =
Empty Empty
foo : Dict Int Int foo : Dict I64 I64
foo = empty foo = empty
main : Dict Int Int main : Dict I64 I64
main = main =
foo foo
"# "#
), ),
"Dict Int Int", "Dict I64 I64",
); );
} }
@ -3370,12 +3370,12 @@ mod solve_expr {
removeHelpEQGT targetKey (removeHelpPrepEQGT targetKey dict color key value left right) removeHelpEQGT targetKey (removeHelpPrepEQGT targetKey dict color key value left right)
main : Dict Int Int main : Dict I64 I64
main = main =
removeHelp 1 Empty removeHelp 1 Empty
"# "#
), ),
"Dict Int Int", "Dict I64 I64",
); );
} }
@ -3410,12 +3410,12 @@ mod solve_expr {
Empty Empty
main : Dict Int main : Dict I64
main = main =
removeHelp 1 Empty removeHelp 1 Empty
"# "#
), ),
"Dict Int", "Dict I64",
); );
} }
@ -3486,12 +3486,12 @@ mod solve_expr {
removeMin : Dict k v -> Dict k v removeMin : Dict k v -> Dict k v
main : Dict Int Int main : Dict I64 I64
main = main =
removeHelp 1 Empty removeHelp 1 Empty
"# "#
), ),
"Dict Int Int", "Dict I64 I64",
); );
} }
@ -3502,7 +3502,7 @@ mod solve_expr {
r#" r#"
app "test" provides [ partitionHelp ] to "./platform" app "test" provides [ partitionHelp ] to "./platform"
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -3513,7 +3513,7 @@ mod solve_expr {
_ -> _ ->
[] []
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -3529,7 +3529,7 @@ mod solve_expr {
Pair i list Pair i list
"# "#
), ),
"Int, Int, List (Num a), Int, Num a -> [ Pair Int (List (Num a)) ]", "I64, I64, List (Num a), I64, Num a -> [ Pair I64 (List (Num a)) ]",
); );
} }
@ -3546,12 +3546,12 @@ mod solve_expr {
balance = \key, left -> balance = \key, left ->
Node key left Empty Node key left Empty
main : Dict Int main : Dict I64
main = main =
balance 0 Empty balance 0 Empty
"# "#
), ),
"Dict Int", "Dict I64",
); );
} }
@ -3570,12 +3570,12 @@ mod solve_expr {
balance = \key, left -> balance = \key, left ->
node key left Empty node key left Empty
main : Dict Int main : Dict I64
main = main =
balance 0 Empty balance 0 Empty
"# "#
), ),
"Dict Int", "Dict I64",
); );
} }
@ -3619,12 +3619,12 @@ mod solve_expr {
_ -> _ ->
Node color key value left right Node color key value left right
main : Dict Int Int main : Dict I64 I64
main = main =
balance Red 0 0 Empty Empty balance Red 0 0 Empty Empty
"# "#
), ),
"Dict Int Int", "Dict I64 I64",
); );
} }
@ -3648,12 +3648,12 @@ mod solve_expr {
Empty Empty
main : Dict Int main : Dict I64
main = main =
balance 0 Empty balance 0 Empty
"# "#
), ),
"Dict Int", "Dict I64",
); );
} }
} }

View file

@ -1124,7 +1124,7 @@ mod solve_uniq_expr {
x x
"# "#
), ),
"Attr * Int", "Attr * I64",
); );
} }
@ -1377,7 +1377,7 @@ mod solve_uniq_expr {
x x
"# "#
), ),
"Attr * Int", "Attr * I64",
); );
} }
@ -1405,7 +1405,7 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1418,7 +1418,7 @@ mod solve_uniq_expr {
swap swap
"# "#
), ),
"Attr * (Attr * Int, Attr * Int, Attr * (List (Attr Shared a)) -> Attr * (List (Attr Shared a)))" "Attr * (Attr * I64, Attr * I64, Attr * (List (Attr Shared a)) -> Attr * (List (Attr Shared a)))"
); );
} }
@ -1431,7 +1431,7 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
quicksort : List (Num a), Int, Int -> List (Num a) quicksort : List (Num a), I64, I64 -> List (Num a)
quicksort = \list, low, high -> quicksort = \list, low, high ->
when partition low high list is when partition low high list is
Pair partitionIndex partitioned -> Pair partitionIndex partitioned ->
@ -1440,7 +1440,7 @@ mod solve_uniq_expr {
|> quicksort (partitionIndex + 1) high |> quicksort (partitionIndex + 1) high
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -1452,7 +1452,7 @@ mod solve_uniq_expr {
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -1480,7 +1480,7 @@ mod solve_uniq_expr {
quicksort quicksort
"# "#
), ),
"Attr Shared (Attr b (List (Attr Shared (Num (Attr Shared a)))), Attr Shared Int, Attr Shared Int -> Attr b (List (Attr Shared (Num (Attr Shared a)))))" "Attr Shared (Attr b (List (Attr Shared (Num (Attr Shared a)))), Attr Shared I64, Attr Shared I64 -> Attr b (List (Attr Shared (Num (Attr Shared a)))))"
); );
}) })
} }
@ -2149,7 +2149,7 @@ mod solve_uniq_expr {
Num.maxInt // Num.maxInt Num.maxInt // Num.maxInt
"# "#
), ),
"Attr * (Result (Attr * Int) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * I64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2161,7 +2161,7 @@ mod solve_uniq_expr {
3 // 4 3 // 4
"# "#
), ),
"Attr * (Result (Attr * Int) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * I64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2173,7 +2173,7 @@ mod solve_uniq_expr {
3 // Num.maxInt 3 // Num.maxInt
"# "#
), ),
"Attr * (Result (Attr * Int) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * I64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2264,17 +2264,17 @@ mod solve_uniq_expr {
#[test] #[test]
fn list_len() { fn list_len() {
infer_eq("List.len", "Attr * (Attr * (List *) -> Attr * Int)"); infer_eq("List.len", "Attr * (Attr * (List *) -> Attr * I64)");
} }
#[test] #[test]
fn list_get() { fn list_get() {
infer_eq("List.get", "Attr * (Attr (* | b) (List (Attr b a)), Attr * Int -> Attr * (Result (Attr b a) (Attr * [ OutOfBounds ]*)))"); infer_eq("List.get", "Attr * (Attr (* | b) (List (Attr b a)), Attr * I64 -> Attr * (Result (Attr b a) (Attr * [ OutOfBounds ]*)))");
} }
#[test] #[test]
fn list_set() { fn list_set() {
infer_eq("List.set", "Attr * (Attr (* | b | c) (List (Attr b a)), Attr * Int, Attr (b | c) a -> Attr * (List (Attr b a)))"); infer_eq("List.set", "Attr * (Attr (* | b | c) (List (Attr b a)), Attr * I64, Attr (b | c) a -> Attr * (List (Attr b a)))");
} }
#[test] #[test]
@ -2286,7 +2286,7 @@ mod solve_uniq_expr {
fn list_repeat() { fn list_repeat() {
infer_eq( infer_eq(
"List.repeat", "List.repeat",
"Attr * (Attr * Int, Attr Shared a -> Attr * (List (Attr Shared a)))", "Attr * (Attr * I64, Attr Shared a -> Attr * (List (Attr Shared a)))",
); );
} }
@ -2487,15 +2487,15 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
Model : { foo : Int } Model : { foo : I64 }
extract : Model -> Int extract : Model -> I64
extract = \{ foo } -> foo extract = \{ foo } -> foo
extract extract
"# "#
), ),
"Attr * (Attr (* | a) Model -> Attr a Int)", "Attr * (Attr (* | a) Model -> Attr a I64)",
); );
} }
@ -2504,15 +2504,15 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
Model : { foo : Int, bar : Int } Model : { foo : I64, bar : I64 }
extract : Model -> Int extract : Model -> I64
extract = \{ foo } -> foo extract = \{ foo } -> foo
extract extract
"# "#
), ),
"Attr * (Attr (* | a) Model -> Attr a Int)", "Attr * (Attr (* | a) Model -> Attr a I64)",
); );
} }
@ -2521,15 +2521,15 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
Model : { foo : Int, bar : Int } Model : { foo : I64, bar : I64 }
extract : Model -> Int extract : Model -> I64
extract = \{foo, bar} -> foo + bar extract = \{foo, bar} -> foo + bar
extract extract
"# "#
), ),
"Attr * (Attr (* | * | *) Model -> Attr * Int)", "Attr * (Attr (* | * | *) Model -> Attr * I64)",
); );
} }
@ -2627,13 +2627,13 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
f : Int, Int -> Int f : I64, I64 -> I64
f = \a, b -> a + b f = \a, b -> a + b
f f
"# "#
), ),
"Attr * (Attr * Int, Attr * Int -> Attr * Int)", "Attr * (Attr * I64, Attr * I64 -> Attr * I64)",
); );
} }
@ -2642,13 +2642,13 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
foobar : Int -> Int foobar : I64 -> I64
foobar = \x -> Num.abs x foobar = \x -> Num.abs x
foobar foobar
"# "#
), ),
"Attr * (Attr * Int -> Attr * Int)", "Attr * (Attr * I64 -> Attr * I64)",
); );
} }
@ -2662,7 +2662,7 @@ mod solve_uniq_expr {
f f
"# "#
), ),
"Attr * (Attr a Int, Attr b Int -> Attr c Int)", "Attr * (Attr a I64, Attr b I64 -> Attr c I64)",
); );
} }
@ -3001,13 +3001,13 @@ mod solve_uniq_expr {
Model a : { foo : Set a } Model a : { foo : Set a }
initialModel : position -> Model Int initialModel : position -> Model I64
initialModel = \_ -> { foo : Set.empty } initialModel = \_ -> { foo : Set.empty }
initialModel initialModel
"# "#
), ),
"Attr * (Attr * position -> Attr * (Model (Attr * Int)))", "Attr * (Attr * position -> Attr * (Model (Attr * I64)))",
); );
} }
@ -3035,12 +3035,12 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
negatePoint : { x : Int, y : Int, z ? Num c } -> { x : Int, y : Int, z : Num c } negatePoint : { x : I64, y : I64, z ? Num c } -> { x : I64, y : I64, z : Num c }
negatePoint { x: 1, y: 2 } negatePoint { x: 1, y: 2 }
"# "#
), ),
"Attr * { x : Attr * Int, y : Attr * Int, z : Attr * (Num (Attr * c)) }", "Attr * { x : Attr * I64, y : Attr * I64, z : Attr * (Num (Attr * c)) }",
); );
} }
@ -3049,7 +3049,7 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
negatePoint : { x : Int, y : Int, z ? Num c }r -> { x : Int, y : Int, z : Num c }r negatePoint : { x : I64, y : I64, z ? Num c }r -> { x : I64, y : I64, z : Num c }r
a = negatePoint { x: 1, y: 2 } a = negatePoint { x: 1, y: 2 }
b = negatePoint { x: 1, y: 2, blah : "hi" } b = negatePoint { x: 1, y: 2, blah : "hi" }
@ -3057,7 +3057,7 @@ mod solve_uniq_expr {
{ a, b } { a, b }
"# "#
), ),
"Attr * { a : Attr * { x : Attr * Int, y : Attr * Int, z : Attr * (Num (Attr * c)) }, b : Attr * { blah : Attr * Str, x : Attr * Int, y : Attr * Int, z : Attr * (Num (Attr * c)) } }" "Attr * { a : Attr * { x : Attr * I64, y : Attr * I64, z : Attr * (Num (Attr * c)) }, b : Attr * { blah : Attr * Str, x : Attr * I64, y : Attr * I64, z : Attr * (Num (Attr * c)) } }"
); );
} }
@ -3071,7 +3071,7 @@ mod solve_uniq_expr {
negatePoint { x: 1, y: 2.1, z: 0x3 } negatePoint { x: 1, y: 2.1, z: 0x3 }
"# "#
), ),
"Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * Int }", "Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * I64 }",
); );
} }
@ -3149,14 +3149,14 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
empty : List Int empty : List I64
empty = empty =
[] []
List.walkBackwards empty (\a, b -> a + b) 0 List.walkBackwards empty (\a, b -> a + b) 0
"# "#
), ),
"Attr a Int", "Attr a I64",
); );
} }
} }

View file

@ -50,7 +50,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
// Int : Num Integer // Int : Num Integer
add_alias( add_alias(
Symbol::NUM_INT, Symbol::NUM_I64,
BuiltinAlias { BuiltinAlias {
region: Region::zero(), region: Region::zero(),
vars: Vec::new(), vars: Vec::new(),
@ -155,7 +155,7 @@ fn float_alias_content() -> SolvedType {
#[inline(always)] #[inline(always)]
pub fn int_type() -> SolvedType { pub fn int_type() -> SolvedType {
SolvedType::Alias(Symbol::NUM_INT, Vec::new(), Box::new(int_alias_content())) SolvedType::Alias(Symbol::NUM_I64, Vec::new(), Box::new(int_alias_content()))
} }
#[inline(always)] #[inline(always)]

View file

@ -19,8 +19,8 @@ static EMPTY_TAG_UNION: &str = "[]";
/// ///
/// Separately, if we're inside a type parameter, we may need to use parens: /// Separately, if we're inside a type parameter, we may need to use parens:
/// ///
/// List Int /// List I64
/// List (List Int) /// List (List I64)
/// ///
/// Otherwise, parens are unnecessary. /// Otherwise, parens are unnecessary.
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
@ -330,7 +330,7 @@ fn write_content(env: &Env, content: Content, subs: &Subs, buf: &mut String, par
match &content { match &content {
Alias(nested, _, _) => match *nested { Alias(nested, _, _) => match *nested {
Symbol::NUM_INTEGER => buf.push_str("Int"), Symbol::NUM_INTEGER => buf.push_str("I64"),
Symbol::NUM_FLOATINGPOINT => buf.push_str("F64"), Symbol::NUM_FLOATINGPOINT => buf.push_str("F64"),
_ => write_parens!(write_parens, buf, { _ => write_parens!(write_parens, buf, {
@ -343,7 +343,7 @@ fn write_content(env: &Env, content: Content, subs: &Subs, buf: &mut String, par
let attr_content = subs.get_without_compacting(nested_args[1]).content; let attr_content = subs.get_without_compacting(nested_args[1]).content;
match &attr_content { match &attr_content {
Alias(nested, _, _) => match *nested { Alias(nested, _, _) => match *nested {
Symbol::NUM_INTEGER => buf.push_str("Int"), Symbol::NUM_INTEGER => buf.push_str("I64"),
Symbol::NUM_FLOATINGPOINT => buf.push_str("F64"), Symbol::NUM_FLOATINGPOINT => buf.push_str("F64"),
_ => write_parens!(write_parens, buf, { _ => write_parens!(write_parens, buf, {
buf.push_str("Num "); buf.push_str("Num ");
@ -403,7 +403,7 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
Record(fields, ext_var) => { Record(fields, ext_var) => {
use crate::types::{gather_fields, RecordStructure}; use crate::types::{gather_fields, RecordStructure};
// If the `ext` has concrete fields (e.g. { foo : Int}{ bar : Bool }), merge them // If the `ext` has concrete fields (e.g. { foo : I64}{ bar : Bool }), merge them
let RecordStructure { fields, ext } = gather_fields(subs, fields, ext_var); let RecordStructure { fields, ext } = gather_fields(subs, fields, ext_var);
let ext_var = ext; let ext_var = ext;
@ -465,8 +465,8 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
// This is an open record, so print the variable // This is an open record, so print the variable
// right after the '}' // right after the '}'
// //
// e.g. the "*" at the end of `{ x: Int }*` // e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: Int }r` // or the "r" at the end of `{ x: I64 }r`
write_content(env, content, subs, buf, parens) write_content(env, content, subs, buf, parens)
} }
} }
@ -523,8 +523,8 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
// This is an open tag union, so print the variable // This is an open tag union, so print the variable
// right after the ']' // right after the ']'
// //
// e.g. the "*" at the end of `{ x: Int }*` // e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: Int }r` // or the "r" at the end of `{ x: I64 }r`
write_content(env, content, subs, buf, parens) write_content(env, content, subs, buf, parens)
} }
} }
@ -576,8 +576,8 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
// This is an open tag union, so print the variable // This is an open tag union, so print the variable
// right after the ']' // right after the ']'
// //
// e.g. the "*" at the end of `{ x: Int }*` // e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: Int }r` // or the "r" at the end of `{ x: I64 }r`
write_content(env, content, subs, buf, parens) write_content(env, content, subs, buf, parens)
} }
@ -754,7 +754,7 @@ fn write_apply(
match &arg_content { match &arg_content {
Content::Structure(FlatType::Apply(symbol, nested_args)) => match *symbol { Content::Structure(FlatType::Apply(symbol, nested_args)) => match *symbol {
Symbol::NUM_INTEGER if nested_args.is_empty() => { Symbol::NUM_INTEGER if nested_args.is_empty() => {
buf.push_str("Int"); buf.push_str("I64");
} }
Symbol::NUM_FLOATINGPOINT if nested_args.is_empty() => { Symbol::NUM_FLOATINGPOINT if nested_args.is_empty() => {
buf.push_str("F64"); buf.push_str("F64");
@ -768,7 +768,7 @@ fn write_apply(
double_nested_args, double_nested_args,
))) => match double_nested_symbol { ))) => match double_nested_symbol {
Symbol::NUM_INTEGER if double_nested_args.is_empty() => { Symbol::NUM_INTEGER if double_nested_args.is_empty() => {
buf.push_str("Int"); buf.push_str("I64");
} }
Symbol::NUM_FLOATINGPOINT if double_nested_args.is_empty() => { Symbol::NUM_FLOATINGPOINT if double_nested_args.is_empty() => {
buf.push_str("F64"); buf.push_str("F64");

View file

@ -14,7 +14,7 @@ use roc_types::types::Type::{self, *};
pub fn int_literal(num_var: Variable, expected: Expected<Type>, region: Region) -> Constraint { pub fn int_literal(num_var: Variable, expected: Expected<Type>, region: Region) -> Constraint {
let num_type = Variable(num_var); let num_type = Variable(num_var);
let reason = Reason::IntLiteral; let reason = Reason::IntLiteral;
let int_type = builtin_type(Symbol::NUM_INT, vec![]); let int_type = builtin_type(Symbol::NUM_I64, vec![]);
let expected_literal = ForReason(reason, int_type, region); let expected_literal = ForReason(reason, int_type, region);
exists( exists(

View file

@ -1,6 +1,6 @@
app "closure" provides [ makeClosure ] to "./platform/" app "closure" provides [ makeClosure ] to "./platform/"
makeClosure : ({} -> Int) as MyClosure makeClosure : ({} -> I64) as MyClosure
makeClosure = makeClosure =
x = 42 x = 42
y = 42 y = 42

View file

@ -5,7 +5,7 @@ ConsList a : [ Cons a (ConsList a), Nil ]
empty : ConsList a empty : ConsList a
empty = Nil empty = Nil
len : ConsList a -> Int len : ConsList a -> I64
len = \list -> len = \list ->
when list is when list is
Cons _ rest -> 1 + len rest Cons _ rest -> 1 + len rest

View file

@ -21,11 +21,11 @@ singleton = \key, value ->
Node Black key value Empty Empty Node Black key value Empty Empty
# {-| Determine the number of key-value pairs in the dictionary. -} # {-| Determine the number of key-value pairs in the dictionary. -}
size : Dict k v -> Int size : Dict k v -> I64
size = \dict -> size = \dict ->
sizeHelp 0 dict sizeHelp 0 dict
sizeHelp : Int, Dict k v -> Int sizeHelp : I64, Dict k v -> I64
sizeHelp = \n, dict -> sizeHelp = \n, dict ->
when dict is when dict is
Empty -> Empty ->

View file

@ -1,9 +1,9 @@
app "quicksort" imports [ Utils.{ swap } ] provides [ quicksort ] to "./platform" app "quicksort" imports [ Utils.{ swap } ] provides [ quicksort ] to "./platform"
quicksort : List Int -> List Int quicksort : List I64 -> List I64
quicksort = \originalList -> quicksort = \originalList ->
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -14,7 +14,7 @@ quicksort = \originalList ->
else else
list list
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -26,7 +26,7 @@ quicksort = \originalList ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is

View file

@ -1,6 +1,6 @@
interface Utils exposes [ swap ] imports [] interface Utils exposes [ swap ] imports []
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->

View file

@ -2,7 +2,7 @@ app "quicksort" provides [ quicksort ] to "./platform"
quicksort = \originalList -> quicksort = \originalList ->
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -14,7 +14,7 @@ quicksort = \originalList ->
list list
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -25,7 +25,7 @@ quicksort = \originalList ->
Err _ -> Err _ ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is
@ -41,7 +41,7 @@ quicksort = \originalList ->
Pair i list Pair i list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->

View file

@ -1,12 +1,12 @@
app "quicksort" packages { base: "./platform" } provides [ quicksort ] to base app "quicksort" packages { base: "./platform" } provides [ quicksort ] to base
quicksort : List Int -> List Int quicksort : List I64 -> List I64
quicksort = \originalList -> helper originalList quicksort = \originalList -> helper originalList
helper : List Int -> List Int helper : List I64 -> List I64
helper = \originalList -> helper = \originalList ->
quicksortHelp : List (Num a), Int, Int -> List (Num a) quicksortHelp : List (Num a), I64, I64 -> List (Num a)
quicksortHelp = \list, low, high -> quicksortHelp = \list, low, high ->
if low < high then if low < high then
when partition low high list is when partition low high list is
@ -18,7 +18,7 @@ helper = \originalList ->
list list
swap : Int, Int, List a -> List a swap : I64, I64, List a -> List a
swap = \i, j, list -> swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) -> Pair (Ok atI) (Ok atJ) ->
@ -29,7 +29,7 @@ helper = \originalList ->
_ -> _ ->
[] []
partition : Int, Int, List (Num a) -> [ Pair Int (List (Num a)) ] partition : I64, I64, List (Num a) -> [ Pair I64 (List (Num a)) ]
partition = \low, high, initialList -> partition = \low, high, initialList ->
when List.get initialList high is when List.get initialList high is
Ok pivot -> Ok pivot ->
@ -41,7 +41,7 @@ helper = \originalList ->
Pair (low - 1) initialList Pair (low - 1) initialList
partitionHelp : Int, Int, List (Num a), Int, (Num a) -> [ Pair Int (List (Num a)) ] partitionHelp : I64, I64, List (Num a), I64, (Num a) -> [ Pair I64 (List (Num a)) ]
partitionHelp = \i, j, list, high, pivot -> partitionHelp = \i, j, list, high, pivot ->
if j < high then if j < high then
when List.get list j is when List.get list j is