Add Num.log and wire it up

This commit is contained in:
Ju Liu 2021-03-28 15:02:45 +01:00
parent 47ddfd2639
commit 928249df2a
6 changed files with 130 additions and 59 deletions

View file

@ -430,6 +430,20 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
),
);
// log : Float a -> Float a
let log_of_negative = SolvedType::TagUnion(
vec![(TagName::Global("LogOfNegative".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
add_type(
Symbol::NUM_LOG,
top_level_function(
vec![float_type(flex(TVAR1))],
Box::new(result_type(float_type(flex(TVAR1)), log_of_negative)),
),
);
// round : Float a -> Int b
add_type(
Symbol::NUM_ROUND,