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]
fn literal_0x0() {
expect_success("0x0", "0 : Int");
expect_success("0x0", "0 : I64");
}
#[test]
fn literal_0x42() {
expect_success("0x42", "66 : Int");
expect_success("0x42", "66 : I64");
}
#[test]
@ -79,7 +79,7 @@ mod repl_eval {
#[test]
fn int_addition() {
expect_success("0x1 + 2", "3 : Int");
expect_success("0x1 + 2", "3 : I64");
}
#[test]
@ -89,7 +89,7 @@ mod repl_eval {
#[test]
fn num_rem() {
expect_success("299 % 10", "Ok 9 : Result Int [ DivByZero ]*");
expect_success("299 % 10", "Ok 9 : Result I64 [ DivByZero ]*");
}
#[test]
@ -191,7 +191,7 @@ mod repl_eval {
#[test]
fn str_count_graphemes() {
expect_success("Str.countGraphemes \"å🤔\"", "2 : Int");
expect_success("Str.countGraphemes \"å🤔\"", "2 : I64");
}
#[test]
@ -206,7 +206,7 @@ mod repl_eval {
#[test]
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]
@ -239,7 +239,7 @@ mod repl_eval {
fn nested_int_list() {
expect_success(
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() {
expect_success(
"{ 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() {
expect_success(
"{ 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() {
expect_success(
"[ { 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![
flex(u),
SolvedType::Alias(
Symbol::NUM_INT,
Symbol::NUM_I64,
Vec::new(),
Box::new(builtin_aliases::num_type(SolvedType::Apply(
Symbol::ATTR_ATTR,

View file

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

View file

@ -92,7 +92,7 @@ pub fn num_floatingpoint() -> Type {
#[inline(always)]
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)]

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
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 ->
when partition low high list is
Pair partitionIndex partitioned ->
@ -9,7 +9,7 @@ quicksort = \list, low, high ->
|> quicksort (partitionIndex + 1) high
swap : Int, Int, List a -> List a
swap : I64, I64, List a -> List a
swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
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 ->
when List.get initialList high is
Ok pivot ->
@ -33,7 +33,7 @@ partition = \low, high, 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 ->
if j < high then
when List.get list j is

View file

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

View file

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

View file

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

View file

@ -742,7 +742,7 @@ define_builtins! {
1 NUM: "Num" => {
0 NUM_NUM: "Num" imported // the Num.Num type alias
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
4 NUM_AT_INTEGER: "@Integer" // the Int.@Integer private tag
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),
Alias(Symbol::NUM_INT, args, _) => {
Alias(Symbol::NUM_I64, args, _) => {
debug_assert!(args.is_empty());
Ok(Layout::Builtin(Builtin::Int64))
}
@ -723,7 +723,7 @@ fn layout_from_flat_type<'a>(
match flat_type {
Apply(symbol, args) => {
match symbol {
Symbol::NUM_INT => {
Symbol::NUM_I64 => {
debug_assert_eq!(args.len(), 0);
Ok(Layout::Builtin(Builtin::Int64))
}

View file

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

View file

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

View file

@ -623,7 +623,7 @@ mod test_reporting {
Num
Set
Result
Int
F64
"#
),
);
@ -634,7 +634,7 @@ mod test_reporting {
// report_problem_as(
// indoc!(
// r#"
// foo : Int as Int
// foo : I64 as I64
// foo = 42
//
// foo
@ -657,7 +657,7 @@ mod test_reporting {
// report_problem_as(
// indoc!(
// r#"
// foo : Int as a
// foo : I64 as a
// foo = 42
//
// foo
@ -961,7 +961,7 @@ mod test_reporting {
r#"
bar = { bar : 0x3 }
f : { foo : Int } -> Bool
f : { foo : I64 } -> Bool
f = \_ -> True
f bar
@ -978,11 +978,11 @@ mod test_reporting {
This `bar` value is a:
{ bar : Int }
{ bar : I64 }
But `f` needs the 1st argument to be:
{ foo : Int }
{ foo : I64 }
Tip: Seems like a record field typo. Maybe `bar` should be `foo`?
@ -1037,7 +1037,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : [ Red Int, Green Bool ] -> Bool
f : [ Red I64, Green Bool ] -> Bool
f = \_ -> True
f (Blue 3.14)
@ -1058,7 +1058,7 @@ mod test_reporting {
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`?
@ -1075,7 +1075,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : Int
x : I64
x = if True then 3.14 else 4
x
@ -1096,7 +1096,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int
I64
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1110,7 +1110,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : Int
x : I64
x =
when True is
_ -> 3.14
@ -1124,7 +1124,7 @@ mod test_reporting {
Something is off with the body of the `x` definition:
1 x : Int
1 x : I64
2 x =
3> when True is
4> _ -> 3.14
@ -1135,7 +1135,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int
I64
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1149,7 +1149,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : Int -> Int
x : I64 -> I64
x = \_ -> 3.14
x
@ -1161,7 +1161,7 @@ mod test_reporting {
Something is off with the body of the `x` definition:
1 x : Int -> Int
1 x : I64 -> I64
2 x = \_ -> 3.14
^^^^
@ -1171,7 +1171,7 @@ mod test_reporting {
But the type annotation on `x` says it should be:
Int
I64
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1185,7 +1185,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : Int
x : I64
x = 42
x 3
@ -1211,7 +1211,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : Int -> Int
f : I64 -> I64
f = \_ -> 42
f 1 2
@ -1237,7 +1237,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : Int, Int -> Int
f : I64, I64 -> I64
f = \_, _ -> 42
f 1
@ -1372,9 +1372,9 @@ mod test_reporting {
these names seem close though:
Bool
Int
F64
Num
Map
"#
),
)
@ -1483,7 +1483,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
{ x } : { x : Int }
{ x } : { x : I64 }
{ x } = { x: 4.0 }
x
@ -1495,7 +1495,7 @@ mod test_reporting {
Something is off with the body of this definition:
1 { x } : { x : Int }
1 { x } : { x : I64 }
2 { x } = { x: 4.0 }
^^^^^^^^^^
@ -1505,7 +1505,7 @@ mod test_reporting {
But the type annotation says it should be:
{ x : Int }
{ x : I64 }
Tip: You can convert between Int and Float using functions like
`Num.toFloat` and `Num.round`.
@ -1644,7 +1644,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : { a : Int, b : F64, c : Bool }
x : { a : I64, b : F64, c : Bool }
x = { b: 4.0 }
x
@ -1656,7 +1656,7 @@ mod test_reporting {
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 }
^^^^^^^^^^
@ -1666,7 +1666,7 @@ mod test_reporting {
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.
"#
@ -1788,7 +1788,7 @@ mod test_reporting {
The body is an integer of type:
Int
I64
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
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
to be more general?
"#
@ -1810,7 +1810,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : Bool -> [ Ok Int, InvalidFoo ]
f : Bool -> [ Ok I64, InvalidFoo ]
f = \_ -> ok 4
f
@ -1828,9 +1828,9 @@ mod test_reporting {
these names seem close though:
f
Int
F64
Num
Map
"#
),
)
@ -1842,7 +1842,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : Bool -> Int
f : Bool -> I64
f = \_ ->
ok = 3
@ -1867,7 +1867,7 @@ mod test_reporting {
Something is off with the body of the `f` definition:
1 f : Bool -> Int
1 f : Bool -> I64
2 f = \_ ->
3 ok = 3
4
@ -1880,7 +1880,7 @@ mod test_reporting {
But the type annotation on `f` says it should be:
Int
I64
"#
),
)
@ -2005,7 +2005,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { fo: Int }ext -> Int
f : { fo: I64 }ext -> I64
f = \r ->
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:
{ fo : Int
{ fo : I64
}ext
So maybe `.foo` should be `.fo`?
@ -2259,12 +2259,12 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
Either : [ Left Int, Right Bool ]
Either : [ Left I64, Right Bool ]
x : Either
x = Left 42
f : Either -> Int
f : Either -> I64
f = \Left v -> v
f x
@ -2296,7 +2296,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
x : [ Left Int, Right Bool ]
x : [ Left I64, Right Bool ]
x = Left 42
@ -2425,7 +2425,7 @@ mod test_reporting {
r#"
RemoteData e a : [ NotAsked, Loading, Failure e, Success a ]
x : RemoteData Int Str
x : RemoteData I64 Str
when x is
NotAsked -> 3
@ -2488,7 +2488,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
y : [ Nothing, Just Int ]
y : [ Nothing, Just I64 ]
y = Just 4
x = { a: y, b: 42}
@ -2581,9 +2581,9 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
Foo : { x : Int }
Foo : { x : I64 }
f : Foo -> Int
f : Foo -> I64
f = \r -> r.x
f { y: 3.14 }
@ -2605,7 +2605,7 @@ mod test_reporting {
But `f` needs the 1st argument to be:
{ x : Int }
{ x : I64 }
Tip: Seems like a record field typo. Maybe `y` should be `x`?
@ -2835,7 +2835,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
a : { foo : Int, bar : F64, foo : Str }
a : { foo : I64, bar : F64, foo : Str }
a = { bar: 3.0, foo: "foo" }
a
@ -2847,12 +2847,12 @@ mod test_reporting {
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:
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
@ -2867,7 +2867,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
a : [ Foo Int, Bar F64, Foo Str ]
a : [ Foo I64, Bar F64, Foo Str ]
a = Foo "foo"
a
@ -2879,12 +2879,12 @@ mod test_reporting {
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:
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
@ -2899,7 +2899,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
bar : Int
bar : I64
foo = \x -> x
# 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
it:
1> bar : Int
1> bar : I64
2> foo = \x -> x
Is it a typo? If not, put either a newline or comment between them.
@ -2927,7 +2927,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
bar : Int
bar : I64
foo = \x -> x
@ -2943,7 +2943,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
MyAlias 1 : Int
MyAlias 1 : I64
4
"#
@ -2954,7 +2954,7 @@ mod test_reporting {
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.
@ -2963,7 +2963,7 @@ mod test_reporting {
`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
@ -2978,7 +2978,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
a : Num Int F64
a : Num I64 F64
a = 3
a
@ -2990,7 +2990,7 @@ mod test_reporting {
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?
@ -3004,7 +3004,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : Bool -> Num Int F64
f : Bool -> Num I64 F64
f = \_ -> 3
f
@ -3016,7 +3016,7 @@ mod test_reporting {
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?
@ -3032,7 +3032,7 @@ mod test_reporting {
r#"
Pair a b : [ Pair a b ]
x : Pair Int
x : Pair I64
x = Pair 2 3
x
@ -3044,7 +3044,7 @@ mod test_reporting {
The `Pair` alias expects 2 type arguments, but it got 1 instead:
3 x : Pair Int
3 x : Pair I64
^^^^^^^^
Are there missing parentheses?
@ -3060,7 +3060,7 @@ mod test_reporting {
r#"
Pair a b : [ Pair a b ]
x : Pair Int Int Int
x : Pair I64 I64 I64
x = 3
x
@ -3072,7 +3072,7 @@ mod test_reporting {
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?
@ -3088,7 +3088,7 @@ mod test_reporting {
r#"
Foo a : [ Foo ]
f : Foo Int
f : Foo I64
f
"#
@ -3176,7 +3176,7 @@ mod test_reporting {
AList a b : [ ACons a (BList a b), ANil ]
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 ))
y : BList a a
@ -3191,19 +3191,19 @@ mod test_reporting {
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 ))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This `ACons` global tag application has the type:
[ 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 ]
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(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \{ x, y ? "foo" } -> (\g, _ -> g) x y
f
@ -3592,11 +3592,11 @@ mod test_reporting {
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:
{ x : Int, y ? Int }
{ x : I64, y ? I64 }
"#
),
)
@ -3608,7 +3608,7 @@ mod test_reporting {
indoc!(
r#"
\rec ->
{ x, y } : { x : Int, y ? Bool }
{ x, y } : { x : I64, y ? Bool }
{ x, y } = rec
{ x, y }
@ -3620,16 +3620,16 @@ mod test_reporting {
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
The body is a value of type:
{ x : Int, y : Bool }
{ x : I64, y : Bool }
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
says this field is optional. Learn more about optional fields at TODO.
@ -3643,7 +3643,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \{ x, y } -> x + y
f
@ -3660,11 +3660,11 @@ mod test_reporting {
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:
{ x : Int, y ? Int }
{ x : I64, y ? I64 }
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.
@ -3678,7 +3678,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \r ->
when r is
{ x, y } -> x + y
@ -3697,11 +3697,11 @@ mod test_reporting {
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:
{ x : Int, y ? Int }
{ x : I64, y ? I64 }
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.
@ -3715,7 +3715,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \r -> r.y
f
@ -3732,11 +3732,11 @@ mod test_reporting {
This `r` value is a:
{ x : Int, y ? Int }
{ x : I64, y ? I64 }
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
says this field is optional. Learn more about optional fields at TODO.
@ -3750,7 +3750,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \r -> .y r
f
@ -3767,11 +3767,11 @@ mod test_reporting {
This `r` value is a:
{ x : Int, y ? Int }
{ x : I64, y ? I64 }
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
says this field is optional. Learn more about optional fields at TODO.
@ -3785,7 +3785,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y : Int } -> Int
f : { x : I64, y : I64 } -> I64
f = \r ->
when r is
{ x, y : "foo" } -> x + 0
@ -3805,11 +3805,11 @@ mod test_reporting {
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:
{ x : Int, y : Int }
{ x : I64, y : I64 }
"#
),
)
@ -3820,7 +3820,7 @@ mod test_reporting {
report_problem_as(
indoc!(
r#"
f : { x : Int, y ? Int } -> Int
f : { x : I64, y ? I64 } -> I64
f = \r ->
when r is
{ 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:
{ x : Int, y ? Str }
{ x : I64, y ? Str }
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(
indoc!(
r#"
int : Int
int : I64
int
"#
),
"Int",
"I64",
);
}
@ -1345,7 +1345,7 @@ mod solve_expr {
int
"#
),
"Int",
"I64",
);
}
@ -1354,13 +1354,13 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Int
int : I64
int = 5
int
"#
),
"Int",
"I64",
);
}
@ -1369,13 +1369,13 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
int : Num.Int
int : Num.I64
int = 5
int
"#
),
"Int",
"I64",
);
}
@ -1390,7 +1390,7 @@ mod solve_expr {
int
"#
),
"Int",
"I64",
);
}
@ -1405,7 +1405,7 @@ mod solve_expr {
int
"#
),
"Int",
"I64",
);
}
@ -1489,13 +1489,13 @@ mod solve_expr {
r#"
Res a e : [ Okay a, Error e ]
ok : Res Int *
ok : Res I64 *
ok = Okay 5
ok
"#
),
"Res Int *",
"Res I64 *",
);
}
@ -1521,13 +1521,13 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
ok : Result Int *
ok : Result I64 *
ok = Ok 5
ok
"#
),
"Result Int *",
"Result I64 *",
);
}
@ -1551,7 +1551,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
ok : Result Int *
ok : Result I64 *
ok = Ok 5
err : Result * Str
@ -1563,7 +1563,7 @@ mod solve_expr {
err
"#
),
"Result Int Str",
"Result I64 Str",
);
}
@ -1584,19 +1584,19 @@ mod solve_expr {
// #[test]
// 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.
// infer_eq_without_problem(
// indoc!(
// r#"
// int : Int
// int : I64
// p = (\x -> x) int
// p
// "#
// ),
// "Int",
// "I64",
// );
// }
@ -1631,7 +1631,7 @@ mod solve_expr {
x
"#
),
"Int",
"I64",
);
}
@ -1840,7 +1840,7 @@ mod solve_expr {
v
"#
),
"Foo Int",
"Foo I64",
);
}
@ -1907,7 +1907,7 @@ mod solve_expr {
length
"#
),
"Peano -> Int",
"Peano -> I64",
);
}
@ -2253,13 +2253,13 @@ mod solve_expr {
// infer_eq_without_problem(
// indoc!(
// r#"
// UserId x : [ UserId Int ]
// UserId x : [ UserId I64 ]
// UserId x = UserId 42
// x
// "#
// ),
// "Int",
// "I64",
// );
// }
@ -2340,13 +2340,13 @@ mod solve_expr {
ListB a : [ Cons a (ListC a) ]
ListC a : [ Cons a (ListA a), Nil ]
val : ListC Num.Int
val : ListC Num.I64
val = Cons 1 (Cons 2 (Cons 3 Nil))
val
"#
),
"ListC Int",
"ListC I64",
);
}
@ -2388,7 +2388,7 @@ mod solve_expr {
infer_eq_without_problem(
indoc!(
r#"
partition : Int, Int, List Int -> [ Pair Int (List Int) ]
partition : I64, I64, List I64 -> [ Pair I64 (List I64) ]
partition = \low, high, initialList ->
when List.get initialList high is
Ok _ ->
@ -2400,7 +2400,7 @@ mod solve_expr {
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(
indoc!(
r#"
swap : Int, Int, List a -> List a
swap : I64, I64, List a -> List a
swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) ->
@ -2421,7 +2421,7 @@ mod solve_expr {
_ ->
list
partition : Int, Int, List Int -> [ Pair Int (List Int) ]
partition : I64, I64, List I64 -> [ Pair I64 (List I64) ]
partition = \low, high, initialList ->
when List.get initialList high is
Ok pivot ->
@ -2449,7 +2449,7 @@ mod solve_expr {
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 -> list
foo : List Int -> List Int
foo : List I64 -> List I64
foo = \initialList -> idList initialList
foo
"#
),
"List Int -> List Int",
"List I64 -> List I64",
);
}
@ -2547,7 +2547,7 @@ mod solve_expr {
Num.ceiling
"#
),
"F64 -> Int",
"F64 -> I64",
);
}
@ -2559,7 +2559,7 @@ mod solve_expr {
Num.floor
"#
),
"F64 -> Int",
"F64 -> I64",
);
}
@ -2571,7 +2571,7 @@ mod solve_expr {
Num.powInt
"#
),
"Int, Int -> Int",
"I64, I64 -> I64",
);
}
@ -2789,15 +2789,15 @@ mod solve_expr {
#[should_panic]
fn rigid_record_quantification() {
// 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 function could not be applied to the `{ foo : Int }` list. Therefore, this function
// That means e.g. `f : { bar : String, foo : I64 } -> Bool }` is a valid argument, but
// that function could not be applied to the `{ foo : I64 }` list. Therefore, this function
// is not allowed.
//
// should hit a debug_assert! in debug mode, and produce a type error in release mode
infer_eq_without_problem(
indoc!(
r#"
test : ({ foo : Int }ext -> Bool), { foo : Int } -> Bool
test : ({ foo : I64 }ext -> Bool), { foo : I64 } -> Bool
test = \fn, a -> fn a
test
@ -2814,12 +2814,12 @@ mod solve_expr {
infer_eq_without_problem(
indoc!(
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 }
"#
),
"{ 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(
indoc!(
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 }
b = negatePoint { x: 1, y: 2, blah : "hi" }
@ -2836,7 +2836,7 @@ mod solve_expr {
{ 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 }
"#
),
"{ x : Num a, y : F64, z : Int }",
"{ x : Num a, y : F64, z : I64 }",
);
}
@ -2917,13 +2917,13 @@ mod solve_expr {
indoc!(
r#"
\rec ->
{ x, y } : { x : Int, y ? Bool }*
{ x, y } : { x : I64, y ? Bool }*
{ x, y ? False } = rec
{ 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(
indoc!(
r#"
empty : List Int
empty : List I64
empty =
[]
List.walkBackwards empty (\a, b -> a + b) 0
"#
),
"Int",
"I64",
);
}
@ -2970,7 +2970,7 @@ mod solve_expr {
g
"#
),
"Int",
"I64",
);
}
@ -3023,7 +3023,7 @@ mod solve_expr {
app "test" provides [ main ] to "./platform"
Bar : [ Bar ]
Foo : [ Foo Bar Int, Empty ]
Foo : [ Foo Bar I64, Empty ]
foo : Foo
foo = Foo Bar 1
@ -3037,7 +3037,7 @@ mod solve_expr {
x
"#
),
"[ Empty, Foo [ Bar ] Int ]",
"[ Empty, Foo [ Bar ] I64 ]",
);
}
@ -3048,7 +3048,7 @@ mod solve_expr {
r#"
app "test" provides [ main ] to "./platform"
Foo : [ @Foo [ @Bar ] Int, @Empty ]
Foo : [ @Foo [ @Bar ] I64, @Empty ]
foo : Foo
foo = @Foo @Bar 1
@ -3062,7 +3062,7 @@ mod solve_expr {
x
"#
),
"[ @Empty, @Foo [ @Bar ] Int ]",
"[ @Empty, @Foo [ @Bar ] I64 ]",
);
}
@ -3073,21 +3073,21 @@ mod solve_expr {
r#"
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 ->
if state.count == 0 then
0
else
1 + foo { count: state.count - 1, x: state.x }
main : Int
main : I64
main =
foo { count: 3, x: {} }
"#
),
"Int",
"I64",
);
}
@ -3108,15 +3108,15 @@ mod solve_expr {
empty =
Empty
foo : Dict Int Int
foo : Dict I64 I64
foo = empty
main : Dict Int Int
main : Dict I64 I64
main =
foo
"#
),
"Dict Int Int",
"Dict I64 I64",
);
}
@ -3370,12 +3370,12 @@ mod solve_expr {
removeHelpEQGT targetKey (removeHelpPrepEQGT targetKey dict color key value left right)
main : Dict Int Int
main : Dict I64 I64
main =
removeHelp 1 Empty
"#
),
"Dict Int Int",
"Dict I64 I64",
);
}
@ -3410,12 +3410,12 @@ mod solve_expr {
Empty
main : Dict Int
main : Dict I64
main =
removeHelp 1 Empty
"#
),
"Dict Int",
"Dict I64",
);
}
@ -3486,12 +3486,12 @@ mod solve_expr {
removeMin : Dict k v -> Dict k v
main : Dict Int Int
main : Dict I64 I64
main =
removeHelp 1 Empty
"#
),
"Dict Int Int",
"Dict I64 I64",
);
}
@ -3502,7 +3502,7 @@ mod solve_expr {
r#"
app "test" provides [ partitionHelp ] to "./platform"
swap : Int, Int, List a -> List a
swap : I64, I64, List a -> List a
swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
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 ->
if j < high then
when List.get list j is
@ -3529,7 +3529,7 @@ mod solve_expr {
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 ->
Node key left Empty
main : Dict Int
main : Dict I64
main =
balance 0 Empty
"#
),
"Dict Int",
"Dict I64",
);
}
@ -3570,12 +3570,12 @@ mod solve_expr {
balance = \key, left ->
node key left Empty
main : Dict Int
main : Dict I64
main =
balance 0 Empty
"#
),
"Dict Int",
"Dict I64",
);
}
@ -3619,12 +3619,12 @@ mod solve_expr {
_ ->
Node color key value left right
main : Dict Int Int
main : Dict I64 I64
main =
balance Red 0 0 Empty Empty
"#
),
"Dict Int Int",
"Dict I64 I64",
);
}
@ -3648,12 +3648,12 @@ mod solve_expr {
Empty
main : Dict Int
main : Dict I64
main =
balance 0 Empty
"#
),
"Dict Int",
"Dict I64",
);
}
}

View file

@ -1124,7 +1124,7 @@ mod solve_uniq_expr {
x
"#
),
"Attr * Int",
"Attr * I64",
);
}
@ -1377,7 +1377,7 @@ mod solve_uniq_expr {
x
"#
),
"Attr * Int",
"Attr * I64",
);
}
@ -1405,7 +1405,7 @@ mod solve_uniq_expr {
infer_eq(
indoc!(
r#"
swap : Int, Int, List a -> List a
swap : I64, I64, List a -> List a
swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) ->
@ -1418,7 +1418,7 @@ mod solve_uniq_expr {
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(
indoc!(
r#"
quicksort : List (Num a), Int, Int -> List (Num a)
quicksort : List (Num a), I64, I64 -> List (Num a)
quicksort = \list, low, high ->
when partition low high list is
Pair partitionIndex partitioned ->
@ -1440,7 +1440,7 @@ mod solve_uniq_expr {
|> quicksort (partitionIndex + 1) high
swap : Int, Int, List a -> List a
swap : I64, I64, List a -> List a
swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
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 ->
when List.get initialList high is
Ok pivot ->
@ -1480,7 +1480,7 @@ mod solve_uniq_expr {
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
"#
),
"Attr * (Result (Attr * Int) (Attr * [ DivByZero ]*))",
"Attr * (Result (Attr * I64) (Attr * [ DivByZero ]*))",
);
}
@ -2161,7 +2161,7 @@ mod solve_uniq_expr {
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
"#
),
"Attr * (Result (Attr * Int) (Attr * [ DivByZero ]*))",
"Attr * (Result (Attr * I64) (Attr * [ DivByZero ]*))",
);
}
@ -2264,17 +2264,17 @@ mod solve_uniq_expr {
#[test]
fn list_len() {
infer_eq("List.len", "Attr * (Attr * (List *) -> Attr * Int)");
infer_eq("List.len", "Attr * (Attr * (List *) -> Attr * I64)");
}
#[test]
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]
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]
@ -2286,7 +2286,7 @@ mod solve_uniq_expr {
fn list_repeat() {
infer_eq(
"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(
indoc!(
r#"
Model : { foo : Int }
Model : { foo : I64 }
extract : Model -> Int
extract : Model -> I64
extract = \{ foo } -> foo
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(
indoc!(
r#"
Model : { foo : Int, bar : Int }
Model : { foo : I64, bar : I64 }
extract : Model -> Int
extract : Model -> I64
extract = \{ foo } -> foo
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(
indoc!(
r#"
Model : { foo : Int, bar : Int }
Model : { foo : I64, bar : I64 }
extract : Model -> Int
extract : Model -> I64
extract = \{foo, bar} -> foo + bar
extract
"#
),
"Attr * (Attr (* | * | *) Model -> Attr * Int)",
"Attr * (Attr (* | * | *) Model -> Attr * I64)",
);
}
@ -2627,13 +2627,13 @@ mod solve_uniq_expr {
infer_eq(
indoc!(
r#"
f : Int, Int -> Int
f : I64, I64 -> I64
f = \a, b -> a + b
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(
indoc!(
r#"
foobar : Int -> Int
foobar : I64 -> I64
foobar = \x -> Num.abs x
foobar
"#
),
"Attr * (Attr * Int -> Attr * Int)",
"Attr * (Attr * I64 -> Attr * I64)",
);
}
@ -2662,7 +2662,7 @@ mod solve_uniq_expr {
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 }
initialModel : position -> Model Int
initialModel : position -> Model I64
initialModel = \_ -> { foo : Set.empty }
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(
indoc!(
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 }
"#
),
"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(
indoc!(
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 }
b = negatePoint { x: 1, y: 2, blah : "hi" }
@ -3057,7 +3057,7 @@ mod solve_uniq_expr {
{ 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 }
"#
),
"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(
indoc!(
r#"
empty : List Int
empty : List I64
empty =
[]
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
add_alias(
Symbol::NUM_INT,
Symbol::NUM_I64,
BuiltinAlias {
region: Region::zero(),
vars: Vec::new(),
@ -155,7 +155,7 @@ fn float_alias_content() -> SolvedType {
#[inline(always)]
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)]

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:
///
/// List Int
/// List (List Int)
/// List I64
/// List (List I64)
///
/// Otherwise, parens are unnecessary.
#[derive(Clone, Copy, Debug, PartialEq)]
@ -330,7 +330,7 @@ fn write_content(env: &Env, content: Content, subs: &Subs, buf: &mut String, par
match &content {
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"),
_ => 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;
match &attr_content {
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"),
_ => write_parens!(write_parens, buf, {
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) => {
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 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
// right after the '}'
//
// e.g. the "*" at the end of `{ x: Int }*`
// or the "r" at the end of `{ x: Int }r`
// e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: I64 }r`
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
// right after the ']'
//
// e.g. the "*" at the end of `{ x: Int }*`
// or the "r" at the end of `{ x: Int }r`
// e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: I64 }r`
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
// right after the ']'
//
// e.g. the "*" at the end of `{ x: Int }*`
// or the "r" at the end of `{ x: Int }r`
// e.g. the "*" at the end of `{ x: I64 }*`
// or the "r" at the end of `{ x: I64 }r`
write_content(env, content, subs, buf, parens)
}
@ -754,7 +754,7 @@ fn write_apply(
match &arg_content {
Content::Structure(FlatType::Apply(symbol, nested_args)) => match *symbol {
Symbol::NUM_INTEGER if nested_args.is_empty() => {
buf.push_str("Int");
buf.push_str("I64");
}
Symbol::NUM_FLOATINGPOINT if nested_args.is_empty() => {
buf.push_str("F64");
@ -768,7 +768,7 @@ fn write_apply(
double_nested_args,
))) => match double_nested_symbol {
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() => {
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 {
let num_type = Variable(num_var);
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);
exists(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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