-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance trampoline, fix function signature, optimize lambda
- Loading branch information
1 parent
41951e1
commit f133107
Showing
18 changed files
with
381 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
idris-jvm-runtime/src/main/java/io/github/mmhelloworld/idrisjvm/runtime/Function3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.github.mmhelloworld.idrisjvm.runtime; | ||
|
||
public interface Function3<T1, T2, T3, R> { | ||
R apply(T1 t1, T2 t2, T3 t3); | ||
} |
6 changes: 6 additions & 0 deletions
6
idris-jvm-runtime/src/main/java/io/github/mmhelloworld/idrisjvm/runtime/Function4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.github.mmhelloworld.idrisjvm.runtime; | ||
|
||
public interface Function4<T1, T2, T3, T4, R> { | ||
R apply(T1 t1, T2 t2, T3 t3, T4 t4); | ||
} | ||
|
6 changes: 6 additions & 0 deletions
6
idris-jvm-runtime/src/main/java/io/github/mmhelloworld/idrisjvm/runtime/Function5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.github.mmhelloworld.idrisjvm.runtime; | ||
|
||
public interface Function5<T1, T2, T3, T4, T5, R> { | ||
R apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5); | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
idris-jvm-runtime/src/main/java/io/github/mmhelloworld/idrisjvm/runtime/Functions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.github.mmhelloworld.idrisjvm.runtime; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
public final class Functions { | ||
private Functions() { | ||
} | ||
|
||
public static final Function<?, ?> IDENTITY = a -> a; | ||
|
||
public static final Function<?, Function<?, ?>> IDENTITY_1 = c -> IDENTITY; | ||
|
||
public static final Function<?, Function<?, Function<?, ?>>> IDENTITY_2 = d -> IDENTITY_1; | ||
|
||
public static final Function<?, Function<?, ?>> CONSTANT = a -> b -> a; | ||
|
||
public static final Function<?, Function<?, Function<?, ?>>> CONSTANT_1 = c -> CONSTANT; | ||
|
||
public static <T1, T2, R> Function<T1, Function<T2, R>> curry(BiFunction<T1, T2, R> f) { | ||
return t1 -> t2 -> f.apply(t1, t2); | ||
} | ||
|
||
public static <T1, T2, T3, R> Function<T1, Function<T2, Function<T3, R>>> curry(Function3<T1, T2, T3, R> f) { | ||
return t1 -> t2 -> t3 -> f.apply(t1, t2, t3); | ||
} | ||
|
||
public static <T1, T2, T3, T4, R> Function<T1, Function<T2, Function<T3, Function<T4, R>>>> curry( | ||
Function4<T1, T2, T3, T4, R> f) { | ||
return t1 -> t2 -> t3 -> t4 -> f.apply(t1, t2, t3, t4); | ||
} | ||
|
||
public static <T1, T2, T3, T4, T5, R> Function<T1, Function<T2, Function<T3, Function<T4, Function<T5, R>>>>> curry( | ||
Function5<T1, T2, T3, T4, T5, R> f) { | ||
return t1 -> t2 -> t3 -> t4 -> t5 -> f.apply(t1, t2, t3, t4, t5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.