Skip to content

Instantly share code, notes, and snippets.

@uehaj
Created October 27, 2014 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uehaj/046956f36f0fe29ee75f to your computer and use it in GitHub Desktop.
Save uehaj/046956f36f0fe29ee75f to your computer and use it in GitHub Desktop.
Higher kind type parameter sample for groovy
import java.util.function.*;
interface Functor<T,R> {
public R fmap(Function<T,R> func, T t);
}
interface Applicative<A,T,R> extends Functor<T,R> {
public A<T> pure(T t);
public A<T> ap(A<Function<T,R>> func, A<R> a); // <*> :: f (a -> b) -> f a -> f b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment