mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-28 17:16:31 +01:00
replace Bool type with Bool=True/False + bugfix
Bool is a type alias for True/False
Bugfix:
[[T] String]
{
[[T] Int]
// this would use the outer T (String),
// but now it correctly uses the inner T (Int).
[T] 1
}
This commit is contained in:
@@ -95,48 +95,3 @@ pub fn to_mers_func_concrete_string_string_to_any(
|
||||
},
|
||||
)
|
||||
}
|
||||
pub fn to_mers_func_concrete_string_string_to_opt_int(
|
||||
f: impl Fn(&str, &str) -> Option<isize> + Send + Sync + 'static,
|
||||
) -> data::function::Function {
|
||||
to_mers_func_concrete_string_string_to_any(
|
||||
Type::newm(vec![
|
||||
Arc::new(data::tuple::TupleT(vec![Type::new(data::int::IntT)])),
|
||||
Arc::new(data::tuple::TupleT(vec![])),
|
||||
]),
|
||||
move |a, b| {
|
||||
Ok(f(a, b)
|
||||
.map(|v| Data::one_tuple(Data::new(data::int::Int(v))))
|
||||
.unwrap_or_else(|| Data::empty_tuple()))
|
||||
},
|
||||
)
|
||||
}
|
||||
pub fn to_mers_func_concrete_string_string_to_bool(
|
||||
f: impl Fn(&str, &str) -> bool + Send + Sync + 'static,
|
||||
) -> data::function::Function {
|
||||
to_mers_func_concrete_string_string_to_any(Type::new(data::bool::BoolT), move |a, b| {
|
||||
Ok(Data::new(data::bool::Bool(f(a, b))))
|
||||
})
|
||||
}
|
||||
pub fn to_mers_func_concrete_string_string_to_opt_string_string(
|
||||
f: impl Fn(&str, &str) -> Option<(String, String)> + Send + Sync + 'static,
|
||||
) -> data::function::Function {
|
||||
to_mers_func_concrete_string_string_to_any(
|
||||
Type::newm(vec![
|
||||
Arc::new(data::tuple::TupleT(vec![])),
|
||||
Arc::new(data::tuple::TupleT(vec![
|
||||
Type::new(data::string::StringT),
|
||||
Type::new(data::string::StringT),
|
||||
])),
|
||||
]),
|
||||
move |a, b| {
|
||||
Ok(f(a, b)
|
||||
.map(|(a, b)| {
|
||||
Data::new(data::tuple::Tuple(vec![
|
||||
Data::new(data::string::String(a)),
|
||||
Data::new(data::string::String(b)),
|
||||
]))
|
||||
})
|
||||
.unwrap_or_else(|| Data::empty_tuple()))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user