Last active
May 8, 2016 11:14
-
-
Save clinuxrulz/0a56108f31bafa1452b7b38eba198285 to your computer and use it in GitHub Desktop.
Derive4J Stream experiment
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package gmail.clinuxrulz.derive4j.test.stream; | |
/** | |
* | |
* @author clintonselke | |
*/ | |
public abstract class ExistsSStreamF<A> { | |
public abstract <R> R apply(ForallSStreamF<A,R> f); | |
} |
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package gmail.clinuxrulz.derive4j.test.stream; | |
/** | |
* | |
* @author clintonselke | |
*/ | |
public abstract class ForallSStreamF<A,R> { | |
public abstract <S> R apply(StreamF<A,S> s); | |
} |
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package gmail.clinuxrulz.derive4j.test.stream; | |
import org.derive4j.Data; | |
/** | |
* | |
* @author clintonselke | |
*/ | |
@Data | |
public abstract class Step<A,S> { | |
public interface Cases<R,A,S> { | |
R Step(A a, S s); | |
} | |
public abstract <R> R match(Cases<R, A, S> cases); | |
} |
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package gmail.clinuxrulz.derive4j.test.stream; | |
import org.derive4j.Data; | |
/** | |
* | |
* @author clintonselke | |
*/ | |
@Data | |
public abstract class Stream<A> { | |
public interface Cases<R,A> { | |
R Stream(ExistsSStreamF<A> c); | |
} | |
public abstract <R> R match(Cases<R, A> cases); | |
} |
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package gmail.clinuxrulz.derive4j.test.stream; | |
import java.util.function.Function; | |
import org.derive4j.Data; | |
/** | |
* | |
* @author clintonselke | |
*/ | |
@Data | |
public abstract class StreamF<A,S> { | |
public interface Cases<R,A,S> { | |
R StreamF(Function<S, Step<A, S>> stepper, S init); | |
} | |
public abstract <R> R match(Cases<R, A, S> cases); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment