Skip to content

Instantly share code, notes, and snippets.

@ItsDoot
Created March 14, 2018 22:48
Show Gist options
  • Save ItsDoot/5f083c93945f5cec634a07a7c5194915 to your computer and use it in GitHub Desktop.
Save ItsDoot/5f083c93945f5cec634a07a7c5194915 to your computer and use it in GitHub Desktop.
class Either<A, B>() {}
interface Monad<M> given M<E> {
shared formal M<A> point<A>(A t) ;
shared formal M<B> bind<A, B>(M<A> box)(M<B>(A) func) ;
}
interface EitherMoad<A> satisfies Monad<<B> => Either<A,B>> {
shared formal actual Either<A,B> point<B>(B b);
shared formal actual Either<A,C> bind<B,C>(Either<A,B> m)(Either<A,C>(B) func);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment