Merge branch 'trunk' into rvcas/list_functions

This commit is contained in:
Richard Feldman 2020-11-24 20:20:51 -05:00 committed by GitHub
commit e6fd9cd884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 159 additions and 152 deletions

View file

@ -64,12 +64,12 @@ mod repl_eval {
#[test] #[test]
fn literal_0point0() { fn literal_0point0() {
expect_success("0.0", "0 : Float"); expect_success("0.0", "0 : F64");
} }
#[test] #[test]
fn literal_4point2() { fn literal_4point2() {
expect_success("4.2", "4.2 : Float"); expect_success("4.2", "4.2 : F64");
} }
#[test] #[test]
@ -84,7 +84,7 @@ mod repl_eval {
#[test] #[test]
fn float_addition() { fn float_addition() {
expect_success("1.1 + 2", "3.1 : Float"); expect_success("1.1 + 2", "3.1 : F64");
} }
#[test] #[test]
@ -148,7 +148,7 @@ mod repl_eval {
#[test] #[test]
fn single_element_tag_union() { fn single_element_tag_union() {
expect_success("True 1", "True 1 : [ True (Num *) ]*"); expect_success("True 1", "True 1 : [ True (Num *) ]*");
expect_success("Foo 1 3.14", "Foo 1 3.14 : [ Foo (Num *) Float ]*"); expect_success("Foo 1 3.14", "Foo 1 3.14 : [ Foo (Num *) F64 ]*");
} }
#[test] #[test]
@ -157,7 +157,7 @@ mod repl_eval {
expect_success( expect_success(
"if 1 == 1 then True 3 else False 3.14", "if 1 == 1 then True 3 else False 3.14",
"True 3 : [ False Float, True (Num *) ]*", "True 3 : [ False F64, True (Num *) ]*",
) )
} }
@ -206,7 +206,7 @@ mod repl_eval {
#[test] #[test]
fn literal_float_list() { fn literal_float_list() {
expect_success("[ 1.1, 2.2, 3.3 ]", "[ 1.1, 2.2, 3.3 ] : List Float"); expect_success("[ 1.1, 2.2, 3.3 ]", "[ 1.1, 2.2, 3.3 ] : List F64");
} }
#[test] #[test]
@ -242,7 +242,7 @@ mod repl_eval {
fn nested_float_list() { fn nested_float_list() {
expect_success( expect_success(
r#"[ [ [ 4, 3, 2 ], [ 1, 0.0 ] ], [ [] ], [] ]"#, r#"[ [ [ 4, 3, 2 ], [ 1, 0.0 ] ], [ [] ], [] ]"#,
r#"[ [ [ 4, 3, 2 ], [ 1, 0 ] ], [ [] ], [] ] : List (List (List Float))"#, r#"[ [ [ 4, 3, 2 ], [ 1, 0 ] ], [ [] ], [] ] : List (List (List F64))"#,
); );
} }
@ -250,7 +250,7 @@ mod repl_eval {
fn list_concat() { fn list_concat() {
expect_success( expect_success(
"List.concat [ 1.1, 2.2 ] [ 3.3, 4.4, 5.5 ]", "List.concat [ 1.1, 2.2 ] [ 3.3, 4.4, 5.5 ]",
"[ 1.1, 2.2, 3.3, 4.4, 5.5 ] : List Float", "[ 1.1, 2.2, 3.3, 4.4, 5.5 ] : List F64",
); );
} }
@ -265,7 +265,7 @@ mod repl_eval {
fn list_sum() { fn list_sum() {
expect_success("List.sum []", "0 : Num *"); expect_success("List.sum []", "0 : Num *");
expect_success("List.sum [ 1, 2, 3 ]", "6 : Num *"); expect_success("List.sum [ 1, 2, 3 ]", "6 : Num *");
expect_success("List.sum [ 1.1, 2.2, 3.3 ]", "6.6 : Float"); expect_success("List.sum [ 1.1, 2.2, 3.3 ]", "6.6 : F64");
} }
#[test] #[test]
@ -284,7 +284,7 @@ mod repl_eval {
fn basic_1_field_f64_record() { fn basic_1_field_f64_record() {
// Even though this gets unwrapped at runtime, the repl should still // Even though this gets unwrapped at runtime, the repl should still
// report it as a record // report it as a record
expect_success("{ foo: 4.2 }", "{ foo: 4.2 } : { foo : Float }"); expect_success("{ foo: 4.2 }", "{ foo: 4.2 } : { foo : F64 }");
} }
#[test] #[test]
@ -303,7 +303,7 @@ mod repl_eval {
// report it as a record // report it as a record
expect_success( expect_success(
"{ foo: { bar: { baz: 4.2 } } }", "{ foo: { bar: { baz: 4.2 } } }",
"{ foo: { bar: { baz: 4.2 } } } : { foo : { bar : { baz : Float } } }", "{ foo: { bar: { baz: 4.2 } } } : { foo : { bar : { baz : F64 } } }",
); );
} }
@ -319,7 +319,7 @@ mod repl_eval {
fn basic_2_field_f64_record() { fn basic_2_field_f64_record() {
expect_success( expect_success(
"{ foo: 4.1, bar: 2.3 }", "{ foo: 4.1, bar: 2.3 }",
"{ bar: 2.3, foo: 4.1 } : { bar : Float, foo : Float }", "{ bar: 2.3, foo: 4.1 } : { bar : F64, foo : F64 }",
); );
} }
@ -327,7 +327,7 @@ mod repl_eval {
fn basic_2_field_mixed_record() { fn basic_2_field_mixed_record() {
expect_success( expect_success(
"{ foo: 4.1, bar: 2 }", "{ foo: 4.1, bar: 2 }",
"{ bar: 2, foo: 4.1 } : { bar : Num *, foo : Float }", "{ bar: 2, foo: 4.1 } : { bar : Num *, foo : F64 }",
); );
} }
@ -335,7 +335,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 : Float }", "{ bar: 2, baz: 5, foo: 4.1 } : { bar : Num *, baz : Int, foo : F64 }",
); );
} }
@ -350,7 +350,7 @@ mod repl_eval {
fn list_of_2_field_records() { fn list_of_2_field_records() {
expect_success( expect_success(
"[ { foo: 4.1, bar: 2 } ]", "[ { foo: 4.1, bar: 2 } ]",
"[ { bar: 2, foo: 4.1 } ] : List { bar : Num *, foo : Float }", "[ { bar: 2, foo: 4.1 } ] : List { bar : Num *, foo : F64 }",
); );
} }
@ -382,7 +382,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 : Float }", "[ { bar: 2, baz: 3, foo: 4.1 } ] : List { bar : Num *, baz : Int, foo : F64 }",
); );
} }

View file

@ -1177,7 +1177,7 @@ fn float_type(u: VarId) -> SolvedType {
vec![ vec![
flex(u), flex(u),
SolvedType::Alias( SolvedType::Alias(
Symbol::NUM_FLOAT, Symbol::NUM_F64,
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

@ -74,7 +74,7 @@ pub fn str_type() -> Type {
#[inline(always)] #[inline(always)]
pub fn num_float() -> Type { pub fn num_float() -> Type {
Type::Alias( Type::Alias(
Symbol::NUM_FLOAT, Symbol::NUM_F64,
vec![], vec![],
Box::new(num_num(num_floatingpoint())), Box::new(num_num(num_floatingpoint())),
) )

View file

@ -619,7 +619,7 @@ mod gen_list {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
empty : List Float empty : List F64
empty = empty =
[] []

View file

@ -293,7 +293,7 @@ mod gen_primitives {
indoc!( indoc!(
r#" r#"
wrapper = \{} -> wrapper = \{} ->
alwaysFloatIdentity : Int -> (Float -> Float) alwaysFloatIdentity : Int -> (F64 -> F64)
alwaysFloatIdentity = \_ -> alwaysFloatIdentity = \_ ->
(\a -> a) (\a -> a)
@ -1016,11 +1016,11 @@ mod gen_primitives {
runEffect : Effect a -> a runEffect : Effect a -> a
runEffect = \@Effect thunk -> thunk {} runEffect = \@Effect thunk -> thunk {}
foo : Effect Float foo : Effect F64
foo = foo =
succeed 3.14 succeed 3.14
main : Float main : F64
main = main =
runEffect foo runEffect foo
@ -1041,14 +1041,14 @@ mod gen_primitives {
# succeed : a -> ({} -> a) # succeed : a -> ({} -> a)
succeed = \x -> \{} -> x succeed = \x -> \{} -> x
foo : {} -> Float foo : {} -> F64
foo = foo =
succeed 3.14 succeed 3.14
# runEffect : ({} -> a) -> a # runEffect : ({} -> a) -> a
runEffect = \thunk -> thunk {} runEffect = \thunk -> thunk {}
main : Float main : F64
main = main =
runEffect foo runEffect foo
"# "#

View file

@ -8,7 +8,7 @@ interface AStar
Model position : Model position :
{ evaluated : Set position { evaluated : Set position
, openSet : Set position , openSet : Set position
, costs : Map.Map position Float , costs : Map.Map position F64
, cameFrom : Map.Map position position , cameFrom : Map.Map position position
} }
@ -22,7 +22,7 @@ initialModel = \start ->
} }
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]* cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model -> cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar -> folder = \position, resSmallestSoFar ->
@ -80,12 +80,12 @@ updateCost = \current, neighbour, model ->
model model
findPath : { costFunction: (position, position -> Float), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]* findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]*
findPath = \{ costFunction, moveFunction, start, end } -> findPath = \{ costFunction, moveFunction, start, end } ->
astar costFunction moveFunction end (initialModel start) astar costFunction moveFunction end (initialModel start)
astar : (position, position -> Float), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]* astar : (position, position -> F64), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*
astar = \costFn, moveFn, goal, model -> astar = \costFn, moveFn, goal, model ->
when cheapestOpen (\position -> costFn goal position) model is when cheapestOpen (\position -> costFn goal position) model is
Err _ -> Err _ ->

View file

@ -8,7 +8,7 @@ interface AStar
Model position : Model position :
{ evaluated : Set position { evaluated : Set position
, openSet : Set position , openSet : Set position
, costs : Map.Map position Float , costs : Map.Map position F64
, cameFrom : Map.Map position position , cameFrom : Map.Map position position
} }
@ -22,7 +22,7 @@ initialModel = \start ->
} }
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]* cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model -> cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar -> folder = \position, resSmallestSoFar ->
@ -80,12 +80,12 @@ updateCost = \current, neighbour, model ->
model model
findPath : { costFunction: (position, position -> Float), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]* findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]*
findPath = \{ costFunction, moveFunction, start, end } -> findPath = \{ costFunction, moveFunction, start, end } ->
astar costFunction moveFunction end (initialModel start) astar costFunction moveFunction end (initialModel start)
astar : (position, position -> Float), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]* astar : (position, position -> F64), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*
astar = \costFn, moveFn, goal, model -> astar = \costFn, moveFn, goal, model ->
when cheapestOpen (\position -> costFn goal position) model is when cheapestOpen (\position -> costFn goal position) model is
Err _ -> Err _ ->

View file

@ -357,14 +357,14 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"floatTest" => "Float", "floatTest" => "F64",
"divisionFn" => "Float, Float -> Result Float [ DivByZero ]*", "divisionFn" => "F64, F64 -> Result F64 [ DivByZero ]*",
"divisionTest" => "Result Float [ DivByZero ]*", "divisionTest" => "Result F64 [ DivByZero ]*",
"intTest" => "Int", "intTest" => "Int",
"x" => "Float", "x" => "F64",
"constantNum" => "Num *", "constantNum" => "Num *",
"divDep1ByDep2" => "Result Float [ DivByZero ]*", "divDep1ByDep2" => "Result F64 [ DivByZero ]*",
"fromDep2" => "Float", "fromDep2" => "F64",
}, },
); );
} }
@ -422,12 +422,12 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"findPath" => "{ costFunction : position, position -> Float, end : position, moveFunction : position -> Set position, start : position } -> Result (List position) [ KeyNotFound ]*", "findPath" => "{ costFunction : position, position -> F64, end : position, moveFunction : position -> Set position, start : position } -> Result (List position) [ KeyNotFound ]*",
"initialModel" => "position -> Model position", "initialModel" => "position -> Model position",
"reconstructPath" => "Map position position, position -> List position", "reconstructPath" => "Map position position, position -> List position",
"updateCost" => "position, position, Model position -> Model position", "updateCost" => "position, position, Model position -> Model position",
"cheapestOpen" => "(position -> Float), Model position -> Result position [ KeyNotFound ]*", "cheapestOpen" => "(position -> F64), Model position -> Result position [ KeyNotFound ]*",
"astar" => "(position, position -> Float), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*", "astar" => "(position, position -> F64), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*",
}, },
); );
} }
@ -454,7 +454,7 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"blah2" => "Float", "blah2" => "F64",
"blah3" => "Str", "blah3" => "Str",
"str" => "Str", "str" => "Str",
"alwaysThree" => "* -> Str", "alwaysThree" => "* -> Str",
@ -476,7 +476,7 @@ mod test_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"blah2" => "Float", "blah2" => "F64",
"blah3" => "Str", "blah3" => "Str",
"str" => "Str", "str" => "Str",
"alwaysThree" => "* -> Str", "alwaysThree" => "* -> Str",

View file

@ -232,14 +232,14 @@ mod test_uniq_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"floatTest" => "Attr Shared Float", "floatTest" => "Attr Shared F64",
"divisionFn" => "Attr Shared (Attr * Float, Attr * Float -> Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*)))", "divisionFn" => "Attr Shared (Attr * F64, Attr * F64 -> Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*)))",
"divisionTest" => "Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))", "divisionTest" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
"intTest" => "Attr * Int", "intTest" => "Attr * Int",
"x" => "Attr * Float", "x" => "Attr * F64",
"constantNum" => "Attr * (Num (Attr * *))", "constantNum" => "Attr * (Num (Attr * *))",
"divDep1ByDep2" => "Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))", "divDep1ByDep2" => "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
"fromDep2" => "Attr * Float", "fromDep2" => "Attr * F64",
}, },
); );
} }
@ -253,12 +253,12 @@ mod test_uniq_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"findPath" => "Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * Float), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))", "findPath" => "Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * F64), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))",
"initialModel" => "Attr * (Attr Shared position -> Attr * (Model (Attr Shared position)))", "initialModel" => "Attr * (Attr Shared position -> Attr * (Model (Attr Shared position)))",
"reconstructPath" => "Attr Shared (Attr Shared (Map (Attr * position) (Attr Shared position)), Attr Shared position -> Attr * (List (Attr Shared position)))", "reconstructPath" => "Attr Shared (Attr Shared (Map (Attr * position) (Attr Shared position)), Attr Shared position -> Attr * (List (Attr Shared position)))",
"updateCost" => "Attr * (Attr Shared position, Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr Shared (Model (Attr Shared position)))", "updateCost" => "Attr * (Attr Shared position, Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr Shared (Model (Attr Shared position)))",
"cheapestOpen" => "Attr * (Attr * (Attr Shared position -> Attr * Float), Attr (* | a | b | c) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))", "cheapestOpen" => "Attr * (Attr * (Attr Shared position -> Attr * F64), Attr (* | a | b | c) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))",
"astar" => "Attr Shared (Attr Shared (Attr Shared position, Attr Shared position -> Attr * Float), Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr * [ Err (Attr * [ KeyNotFound ]*), Ok (Attr * (List (Attr Shared position))) ]*)", "astar" => "Attr Shared (Attr Shared (Attr Shared position, Attr Shared position -> Attr * F64), Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr * [ Err (Attr * [ KeyNotFound ]*), Ok (Attr * (List (Attr Shared position))) ]*)",
}, },
); );
} }
@ -318,7 +318,7 @@ mod test_uniq_load {
expect_types( expect_types(
loaded_module, loaded_module,
hashmap! { hashmap! {
"blah2" => "Attr * Float", "blah2" => "Attr * F64",
"blah3" => "Attr * Str", "blah3" => "Attr * Str",
"str" => "Attr * Str", "str" => "Attr * Str",
"alwaysThree" => "Attr * (* -> Attr * Str)", "alwaysThree" => "Attr * (* -> Attr * Str)",

View file

@ -612,7 +612,7 @@ define_builtins! {
2 NUM_INT: "Int" imported // the Int.Int type alias 2 NUM_INT: "Int" imported // the Int.Int 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_FLOAT: "Float" imported // the Float.Float type alias 5 NUM_F64: "F64" imported // the Num.F64 type alias
6 NUM_FLOATINGPOINT: "FloatingPoint" imported // Float : Num FloatingPoint 6 NUM_FLOATINGPOINT: "FloatingPoint" imported // Float : Num FloatingPoint
7 NUM_AT_FLOATINGPOINT: "@FloatingPoint" // the Float.@FloatingPoint private tag 7 NUM_AT_FLOATINGPOINT: "@FloatingPoint" // the Float.@FloatingPoint private tag
8 NUM_MAX_INT: "maxInt" 8 NUM_MAX_INT: "maxInt"

View file

@ -326,7 +326,7 @@ impl<'a> Layout<'a> {
debug_assert!(args.is_empty()); debug_assert!(args.is_empty());
Ok(Layout::Builtin(Builtin::Int64)) Ok(Layout::Builtin(Builtin::Int64))
} }
Alias(Symbol::NUM_FLOAT, args, _) => { Alias(Symbol::NUM_F64, args, _) => {
debug_assert!(args.is_empty()); debug_assert!(args.is_empty());
Ok(Layout::Builtin(Builtin::Float64)) Ok(Layout::Builtin(Builtin::Float64))
} }
@ -726,7 +726,7 @@ fn layout_from_flat_type<'a>(
debug_assert_eq!(args.len(), 0); debug_assert_eq!(args.len(), 0);
Ok(Layout::Builtin(Builtin::Int64)) Ok(Layout::Builtin(Builtin::Int64))
} }
Symbol::NUM_FLOAT => { Symbol::NUM_F64 => {
debug_assert_eq!(args.len(), 0); debug_assert_eq!(args.len(), 0);
Ok(Layout::Builtin(Builtin::Float64)) Ok(Layout::Builtin(Builtin::Float64))
} }

View file

@ -1624,8 +1624,8 @@ fn to_diff<'b>(
_ => false, _ => false,
}; };
let is_float = |t: &ErrorType| match t { let is_float = |t: &ErrorType| match t {
ErrorType::Type(Symbol::NUM_FLOAT, _) => true, ErrorType::Type(Symbol::NUM_F64, _) => true,
ErrorType::Alias(Symbol::NUM_FLOAT, _, _) => true, ErrorType::Alias(Symbol::NUM_F64, _, _) => true,
_ => false, _ => false,
}; };

View file

@ -1054,7 +1054,7 @@ mod test_reporting {
This `Blue` global tag application has the type: This `Blue` global tag application has the type:
[ Blue Float ]a [ Blue F64 ]a
But `f` needs the 1st argument to be: But `f` needs the 1st argument to be:
@ -1092,7 +1092,7 @@ mod test_reporting {
The 1st branch is a float of type: The 1st branch is a float of type:
Float F64
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
@ -1131,7 +1131,7 @@ mod test_reporting {
This `when`expression produces: This `when`expression produces:
Float F64
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
@ -1167,7 +1167,7 @@ mod test_reporting {
The body is a float of type: The body is a float of type:
Float F64
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
@ -1373,8 +1373,8 @@ mod test_reporting {
Bool Bool
Int Int
F64
Num Num
Map
"# "#
), ),
) )
@ -1501,7 +1501,7 @@ mod test_reporting {
The body is a record of type: The body is a record of type:
{ x : Float } { x : F64 }
But the type annotation says it should be: But the type annotation says it should be:
@ -1644,7 +1644,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
x : { a : Int, b : Float, c : Bool } x : { a : Int, b : F64, c : Bool }
x = { b: 4.0 } x = { b: 4.0 }
x x
@ -1656,17 +1656,17 @@ 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 : Float, c : Bool } 1 x : { a : Int, b : F64, c : Bool }
2 x = { b: 4.0 } 2 x = { b: 4.0 }
^^^^^^^^^^ ^^^^^^^^^^
The body is a record of type: The body is a record of type:
{ b : Float } { b : F64 }
But the type annotation on `x` says it should be: But the type annotation on `x` says it should be:
{ a : Int, b : Float, c : Bool } { a : Int, b : F64, c : Bool }
Tip: Looks like the c and a fields are missing. Tip: Looks like the c and a fields are missing.
"# "#
@ -1829,8 +1829,8 @@ mod test_reporting {
f f
Int Int
F64
Num Num
Map
"# "#
), ),
) )
@ -2119,7 +2119,7 @@ mod test_reporting {
This argument is a float of type: This argument is a float of type:
Float F64
But `add` needs the 2nd argument to be: But `add` needs the 2nd argument to be:
@ -2601,7 +2601,7 @@ mod test_reporting {
This argument is a record of type: This argument is a record of type:
{ y : Float } { y : F64 }
But `f` needs the 1st argument to be: But `f` needs the 1st argument to be:
@ -2835,7 +2835,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
a : { foo : Int, bar : Float, foo : Str } a : { foo : Int, 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 : Float, foo : Str } 1 a : { foo : Int, 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 : Float, foo : Str } 1 a : { foo : Int, 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 Float, Foo Str ] a : [ Foo Int, 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 Float, Foo Str ] 1 a : [ Foo Int, 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 Float, Foo Str ] 1 a : [ Foo Int, 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
@ -2978,7 +2978,7 @@ mod test_reporting {
report_problem_as( report_problem_as(
indoc!( indoc!(
r#" r#"
a : Num Int Float a : Num Int F64
a = 3 a = 3
a a
@ -2990,8 +2990,8 @@ 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 Float 1 a : Num Int 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 Float f : Bool -> Num Int F64
f = \_ -> 3 f = \_ -> 3
f f
@ -3016,8 +3016,8 @@ 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 Float 1 f : Bool -> Num Int F64
^^^^^^^^^^^^^ ^^^^^^^^^^^
Are there missing parentheses? Are there missing parentheses?
"# "#

View file

@ -169,7 +169,7 @@ mod solve_expr {
#[test] #[test]
fn float_literal() { fn float_literal() {
infer_eq("0.5", "Float"); infer_eq("0.5", "F64");
} }
#[test] #[test]
@ -762,7 +762,7 @@ mod solve_expr {
(\a -> a) 3.14 (\a -> a) 3.14
"# "#
), ),
"Float", "F64",
); );
} }
@ -894,7 +894,7 @@ mod solve_expr {
// \l r -> l / r // \l r -> l / r
// "# // "#
// ), // ),
// "Float, Float -> Float", // "F64, F64 -> F64",
// ); // );
// } // }
@ -906,7 +906,7 @@ mod solve_expr {
// 1 / 2 // 1 / 2
// "# // "#
// ), // ),
// "Float", // "F64",
// ); // );
// } // }
@ -1026,7 +1026,7 @@ mod solve_expr {
#[test] #[test]
fn two_field_record() { fn two_field_record() {
infer_eq("{ x: 5, y : 3.14 }", "{ x : Num *, y : Float }"); infer_eq("{ x: 5, y : 3.14 }", "{ x : Num *, y : F64 }");
} }
#[test] #[test]
@ -1414,12 +1414,12 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
float : Float float : F64
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1433,7 +1433,7 @@ mod solve_expr {
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1442,13 +1442,13 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
float : Num.Float float : Num.F64
float = 5.5 float = 5.5
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1457,13 +1457,13 @@ mod solve_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
float : Float float : F64
float = 5.5 float = 5.5
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1478,7 +1478,7 @@ mod solve_expr {
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1578,7 +1578,7 @@ mod solve_expr {
float float
"# "#
), ),
"Float", "F64",
); );
} }
@ -1613,7 +1613,7 @@ mod solve_expr {
{ numIdentity, x : numIdentity 42, y } { numIdentity, x : numIdentity 42, y }
"# "#
), ),
"{ numIdentity : Num a -> Num a, x : Num a, y : Float }", "{ numIdentity : Num a -> Num a, x : Num a, y : F64 }",
); );
} }
@ -1791,7 +1791,7 @@ mod solve_expr {
threePointZero threePointZero
"# "#
), ),
"Float", "F64",
); );
} }
@ -2523,7 +2523,7 @@ mod solve_expr {
Num.toFloat Num.toFloat
"# "#
), ),
"Num * -> Float", "Num * -> F64",
); );
} }
@ -2535,7 +2535,7 @@ mod solve_expr {
Num.pow Num.pow
"# "#
), ),
"Float, Float -> Float", "F64, F64 -> F64",
); );
} }
@ -2547,7 +2547,7 @@ mod solve_expr {
Num.ceiling Num.ceiling
"# "#
), ),
"Float -> Int", "F64 -> Int",
); );
} }
@ -2559,7 +2559,7 @@ mod solve_expr {
Num.floor Num.floor
"# "#
), ),
"Float -> Int", "F64 -> Int",
); );
} }
@ -2583,7 +2583,7 @@ mod solve_expr {
Num.atan Num.atan
"# "#
), ),
"Float -> Float", "F64 -> F64",
); );
} }
@ -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 : Float, z : Int }", "{ x : Num a, y : F64, z : Int }",
); );
} }
@ -2867,7 +2867,7 @@ mod solve_expr {
{ a, b } { a, b }
"# "#
), ),
"{ a : { x : Num a, y : Float, z : c }, b : { blah : Str, x : Num a, y : Float, z : c } }", "{ a : { x : Num a, y : F64, z : c }, b : { blah : Str, x : Num a, y : F64, z : c } }",
); );
} }

View file

@ -75,7 +75,7 @@ mod solve_uniq_expr {
#[test] #[test]
fn float_literal() { fn float_literal() {
infer_eq("0.5", "Attr * Float"); infer_eq("0.5", "Attr * F64");
} }
#[test] #[test]
@ -640,7 +640,7 @@ mod solve_uniq_expr {
(\a -> a) 3.14 (\a -> a) 3.14
"# "#
), ),
"Attr * Float", "Attr * F64",
); );
} }
@ -773,7 +773,7 @@ mod solve_uniq_expr {
// \l r -> l / r // \l r -> l / r
// "# // "#
// ), // ),
// "Float, Float -> Float", // "F64, F64 -> F64",
// ); // );
// } // }
@ -785,7 +785,7 @@ mod solve_uniq_expr {
// 1 / 2 // 1 / 2
// "# // "#
// ), // ),
// "Float", // "F64",
// ); // );
// } // }
@ -1211,7 +1211,7 @@ mod solve_uniq_expr {
{ numIdentity, p, q } { numIdentity, p, q }
"# "#
), ),
"Attr * { numIdentity : Attr Shared (Attr b (Num (Attr a p)) -> Attr b (Num (Attr a p))), p : Attr * (Num (Attr * p)), q : Attr * Float }" "Attr * { numIdentity : Attr Shared (Attr b (Num (Attr a p)) -> Attr b (Num (Attr a p))), p : Attr * (Num (Attr * p)), q : Attr * F64 }"
); );
} }
@ -1831,7 +1831,7 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
Foo : { x : Str, y : Float } Foo : { x : Str, y : F64 }
{ x, y } : Foo { x, y } : Foo
{ x, y } = { x : "foo", y : 3.14 } { x, y } = { x : "foo", y : 3.14 }
@ -1848,7 +1848,7 @@ mod solve_uniq_expr {
infer_eq( infer_eq(
indoc!( indoc!(
r#" r#"
Foo : { x : Str, y : Float } Foo : { x : Str, y : F64 }
Bar : Foo Bar : Foo
@ -2113,7 +2113,7 @@ mod solve_uniq_expr {
Num.maxFloat / Num.maxFloat Num.maxFloat / Num.maxFloat
"# "#
), ),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2125,7 +2125,7 @@ mod solve_uniq_expr {
3.0 / 4.0 3.0 / 4.0
"# "#
), ),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2137,7 +2137,7 @@ mod solve_uniq_expr {
3.0 / Num.maxFloat 3.0 / Num.maxFloat
"# "#
), ),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))", "Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
); );
} }
@ -2772,11 +2772,11 @@ mod solve_uniq_expr {
r#" r#"
Model position : { evaluated : Set position Model position : { evaluated : Set position
, openSet : Set position , openSet : Set position
, costs : Map.Map position Float , costs : Map.Map position F64
, cameFrom : Map.Map position position , cameFrom : Map.Map position position
} }
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]* cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model -> cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar -> folder = \position, resSmallestSoFar ->
@ -2802,7 +2802,7 @@ mod solve_uniq_expr {
cheapestOpen cheapestOpen
"# "#
), ),
"Attr * (Attr * (Attr Shared position -> Attr * Float), Attr (* | * | a | b) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))" "Attr * (Attr * (Attr Shared position -> Attr * F64), Attr (* | * | a | b) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))"
) )
}); });
} }
@ -2815,7 +2815,7 @@ mod solve_uniq_expr {
r#" r#"
Model position : { evaluated : Set position Model position : { evaluated : Set position
, openSet : Set position , openSet : Set position
, costs : Map.Map position Float , costs : Map.Map position F64
, cameFrom : Map.Map position position , cameFrom : Map.Map position position
} }
@ -2867,7 +2867,7 @@ mod solve_uniq_expr {
r#" r#"
Model position : { evaluated : Set position Model position : { evaluated : Set position
, openSet : Set position , openSet : Set position
, costs : Map.Map position Float , costs : Map.Map position F64
, cameFrom : Map.Map position position , cameFrom : Map.Map position position
} }
@ -2881,7 +2881,7 @@ mod solve_uniq_expr {
} }
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]* cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model -> cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar -> folder = \position, resSmallestSoFar ->
@ -2941,12 +2941,12 @@ mod solve_uniq_expr {
model model
findPath : { costFunction: (position, position -> Float), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]* findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]*
findPath = \{ costFunction, moveFunction, start, end } -> findPath = \{ costFunction, moveFunction, start, end } ->
astar costFunction moveFunction end (initialModel start) astar costFunction moveFunction end (initialModel start)
astar : (position, position -> Float), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]* astar : (position, position -> F64), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*
astar = \costFn, moveFn, goal, model -> astar = \costFn, moveFn, goal, model ->
when cheapestOpen (\position -> costFn goal position) model is when cheapestOpen (\position -> costFn goal position) model is
Err _ -> Err _ ->
@ -2972,7 +2972,7 @@ mod solve_uniq_expr {
findPath findPath
"# "#
), ),
"Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * Float), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))" "Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * F64), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))"
) )
}); });
} }
@ -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 * Float, z : Attr * Int }", "Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * Int }",
); );
} }
@ -3088,7 +3088,7 @@ mod solve_uniq_expr {
{ a, b } { a, b }
"# "#
), ),
"Attr * { a : Attr * { x : Attr * (Num (Attr * a)), y : Attr * Float, z : Attr * c }, b : Attr * { blah : Attr * Str, x : Attr * (Num (Attr * a)), y : Attr * Float, z : Attr * c } }" "Attr * { a : Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * c }, b : Attr * { blah : Attr * Str, x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * c } }"
); );
} }

View file

@ -70,7 +70,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
// Float : Num FloatingPoint // Float : Num FloatingPoint
add_alias( add_alias(
Symbol::NUM_FLOAT, Symbol::NUM_F64,
BuiltinAlias { BuiltinAlias {
region: Region::zero(), region: Region::zero(),
vars: Vec::new(), vars: Vec::new(),
@ -143,11 +143,7 @@ fn floatingpoint_alias_content() -> SolvedType {
#[inline(always)] #[inline(always)]
pub fn float_type() -> SolvedType { pub fn float_type() -> SolvedType {
SolvedType::Alias( SolvedType::Alias(Symbol::NUM_F64, Vec::new(), Box::new(float_alias_content()))
Symbol::NUM_FLOAT,
Vec::new(),
Box::new(float_alias_content()),
)
} }
#[inline(always)] #[inline(always)]

View file

@ -331,7 +331,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("Int"),
Symbol::NUM_FLOATINGPOINT => buf.push_str("Float"), 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 ");
@ -344,7 +344,7 @@ fn write_content(env: &Env, content: Content, subs: &Subs, buf: &mut String, par
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("Int"),
Symbol::NUM_FLOATINGPOINT => buf.push_str("Float"), 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 ");
write_content(env, content, subs, buf, parens); write_content(env, content, subs, buf, parens);
@ -757,7 +757,7 @@ fn write_apply(
buf.push_str("Int"); buf.push_str("Int");
} }
Symbol::NUM_FLOATINGPOINT if nested_args.is_empty() => { Symbol::NUM_FLOATINGPOINT if nested_args.is_empty() => {
buf.push_str("Float"); buf.push_str("F64");
} }
Symbol::ATTR_ATTR => match nested_args Symbol::ATTR_ATTR => match nested_args
.get(1) .get(1)
@ -771,7 +771,7 @@ fn write_apply(
buf.push_str("Int"); buf.push_str("Int");
} }
Symbol::NUM_FLOATINGPOINT if double_nested_args.is_empty() => { Symbol::NUM_FLOATINGPOINT if double_nested_args.is_empty() => {
buf.push_str("Float"); buf.push_str("F64");
} }
_ => default_case(subs, arg_content), _ => default_case(subs, arg_content),
}, },

View file

@ -1160,7 +1160,7 @@ fn write_error_type_help(
buf.push_str("Int"); buf.push_str("Int");
} }
Type(Symbol::NUM_FLOATINGPOINT, _) => { Type(Symbol::NUM_FLOATINGPOINT, _) => {
buf.push_str("Float"); buf.push_str("F64");
} }
other => { other => {
let write_parens = parens == Parens::InTypeParam; let write_parens = parens == Parens::InTypeParam;
@ -1278,7 +1278,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
buf.push_str("Int"); buf.push_str("Int");
} }
Type(Symbol::NUM_FLOATINGPOINT, _) => { Type(Symbol::NUM_FLOATINGPOINT, _) => {
buf.push_str("Float"); buf.push_str("F64");
} }
other => { other => {
let write_parens = parens == Parens::InTypeParam; let write_parens = parens == Parens::InTypeParam;

View file

@ -30,7 +30,7 @@ pub fn int_literal(num_var: Variable, expected: Expected<Type>, region: Region)
pub fn float_literal(num_var: Variable, expected: Expected<Type>, region: Region) -> Constraint { pub fn float_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::FloatLiteral; let reason = Reason::FloatLiteral;
let float_type = builtin_type(Symbol::NUM_FLOAT, vec![]); let float_type = builtin_type(Symbol::NUM_F64, vec![]);
let expected_literal = ForReason(reason, float_type, region); let expected_literal = ForReason(reason, float_type, region);
exists( exists(

View file

@ -1,4 +1,4 @@
{ pkgs, isMacOS }: { pkgs, isMacOS, isAarch64 }:
# We require at least specific commit of Zig after the latest tagged # We require at least specific commit of Zig after the latest tagged
# release (0.6.0), so we just download the binaries for that commit # release (0.6.0), so we just download the binaries for that commit
@ -9,10 +9,16 @@ let
if isMacOS if isMacOS
then "macos" then "macos"
else "linux"; else "linux";
archiveName = "zig-${osName}-x86_64-${version}"; archName =
if isAarch64
then "aarch64"
else "x86_64";
archiveName = "zig-${osName}-${archName}-${version}";
sha256 = sha256 =
if isMacOS if isMacOS
then "665c1a7f472cfc5e0715f0ddf6ff8409fb749ac91cbbae68c443b4a37ebd058e" then "665c1a7f472cfc5e0715f0ddf6ff8409fb749ac91cbbae68c443b4a37ebd058e"
else if isAarch64
then "116ms44vx4xz57m9z9lsgrxd1g22qp00m5qbmklky8xdd2jmj24w"
else "bab70ae3bd0af538022bc3ef50d8f34fa8dceac39ba7d9e5d528eee7e6d5a1cf"; else "bab70ae3bd0af538022bc3ef50d8f34fa8dceac39ba7d9e5d528eee7e6d5a1cf";
in in
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {

View file

@ -1,16 +1,21 @@
{ }: { }:
with { let
splitSystem = builtins.split "-" builtins.currentSystem;
currentArch = builtins.elemAt splitSystem 0;
currentOS = builtins.elemAt splitSystem 2;
in with {
# Look here for information about how pin version of nixpkgs # Look here for information about how pin version of nixpkgs
# → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs # → https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs
pkgs = import (builtins.fetchGit { pkgs = import (builtins.fetchGit {
name = "nixpkgs-2020-10-24"; name = "nixpkgs-2020-11-24";
url = "https://github.com/nixos/nixpkgs-channels/"; url = "https://github.com/nixos/nixpkgs/";
ref = "refs/heads/nixpkgs-unstable"; ref = "refs/heads/nixpkgs-unstable";
rev = "502845c3e31ef3de0e424f3fcb09217df2ce6df6"; rev = "6625284c397b44bc9518a5a1567c1b5aae455c08";
}) { }; }) { };
isMacOS = builtins.currentSystem == "x86_64-darwin"; isMacOS = currentOS == "darwin";
isAarch64 = currentArch == "aarch64";
}; };
with (pkgs); with (pkgs);
@ -42,7 +47,7 @@ let
[ ]; [ ];
llvmPkgs = pkgs.llvmPackages_10; llvmPkgs = pkgs.llvmPackages_10;
zig = import ./nix/zig.nix { inherit pkgs isMacOS; }; zig = import ./nix/zig.nix { inherit pkgs isMacOS isAarch64; };
inputs = [ inputs = [
# build libraries # build libraries
rustc rustc