min<A> function
- Bounded<
A> bounded
Creates a monoid that finds the minimum value in a Bounded structure
Example:
void main() {
// Create a bounded integer type for values between 1 and 10
Bounded<int> bounded = BoundedInt(1, 10);
// Create a monoid that finds the minimum value in the bounded structure
BaseMonoid<int> minMonoid = min(bounded);
// Find the minimum value in a list of integers using the minMonoid
List<int> numbers = [5, 2, 8, 4, 1];
int minValue = concatAll(minMonoid)(numbers); // Output: 1 (Minimum value)
}
Implementation
BaseMonoid<A> min<A>(Bounded<A> bounded) {
return _MinMonoid<A>(bounded);
}