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
import static java.lang.System.*; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
// Implementation of a pseudo-GADT in Java, translating the examples from | |
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf | |
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type | |
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it | |
// isomorphic to the targeted 'GADT'. |
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
package org.derive4j.exemple; | |
import java.lang.Integer; | |
import java.lang.Object; | |
import java.lang.Override; | |
import java.util.Optional; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
public final class Expressions { |
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
package org.derive4j.exemple; | |
import java.lang.Object; | |
import java.lang.Override; | |
import java.lang.SuppressWarnings; | |
import java.util.Optional; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
import java.util.function.Supplier; |
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
package scato | |
package benchmarks | |
import org.openjdk.jmh.annotations.{Benchmark, BenchmarkMode, Fork, Mode} | |
import scato.Prelude._ | |
import scato.benchmarks.Data._ | |
@Fork(1) | |
@BenchmarkMode(Array(Mode.Throughput)) | |
class Instantiations { |
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
package org.derive4j.exemple; | |
import java.lang.Boolean; | |
import java.lang.Integer; | |
import java.lang.Object; | |
import java.lang.Override; | |
import java.lang.String; | |
import java.lang.SuppressWarnings; | |
import java.util.Optional; | |
import java.util.function.Function; |
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
public class Example { | |
private int value; | |
public int totallyComplexForSure(int x) { | |
final int result; | |
if (x <= 0) { | |
result = 0; | |
} else if (x == 10) { | |
result = -value; |
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
import java.util.function.Function; | |
import org.derive4j.Data; | |
class Y{} | |
class Z{} | |
@Data | |
public abstract class X<YZ> { | |
X(){} |
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
package org.mfusco.fromgoftolambda.examples.visitor; | |
import java.lang.Object; | |
import java.lang.Override; | |
import java.util.Optional; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
final class Elements { | |
private static final TotalMatchBuilderSquareElement totalMatchBuilderSquareElement = new TotalMatchBuilderSquareElement(); |
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
// The file BoolExprs is generated by derive4j via the @Data annotation. | |
import static BoolExprs.*; | |
import java.util.function.Function; | |
import org.derive4j.Data; | |
@Data | |
interface BoolExpr<E> { |
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
package scalaz | |
import org.openjdk.jmh.annotations._ | |
@Fork(1) | |
@BenchmarkMode(Array(Mode.Throughput)) | |
class AdtEncodingsBench { | |
import AdtEncodingsBench._ |
OlderNewer