Add 2-argument higher-order type and move kinds to their own package

I don't think that we will have higher-order types with more than 2 parameters, so I only made K and K2
This commit is contained in:
dfsek
2025-12-29 16:07:36 -07:00
parent f684c60039
commit 3777fda641
6 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
package com.dfsek.terra.api.util.generic;
import com.dfsek.terra.api.util.generic.kinds.K;
import java.util.function.Function;

View File

@@ -1,5 +1,7 @@
package com.dfsek.terra.api.util.generic;
import com.dfsek.terra.api.util.generic.kinds.K;
import java.util.function.Function;

View File

@@ -1,5 +1,8 @@
package com.dfsek.terra.api.util.generic;
import com.dfsek.terra.api.util.generic.kinds.K;
public interface Monoid<T, M extends K<M, T>> extends Semigroup<T, M>{
<T1, M1 extends K<M1, T1>> Monoid<T1, M1> identity();

View File

@@ -1,5 +1,8 @@
package com.dfsek.terra.api.util.generic;
import com.dfsek.terra.api.util.generic.kinds.K;
public interface Semigroup<T, S extends K<S, T>> {
Semigroup<T, S> multiply(S t);
}

View File

@@ -1,4 +1,4 @@
package com.dfsek.terra.api.util.generic;
package com.dfsek.terra.api.util.generic.kinds;
/**
* Kind

View File

@@ -0,0 +1,7 @@
package com.dfsek.terra.api.util.generic.kinds;
/**
* Kind of the type T<A, B>
*/
public interface K2<T, A, B> {
}