Skip to content

Commit

Permalink
fix data.maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
marudor committed Jan 9, 2018
1 parent ca3d99c commit 9bc721a
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
// @flow

// TODO Once we support dependencies, put into declare module
import type Either from "data.either";

interface Functor<A> {
map<B>(f: (a: A) => B): Functor<B>;
}

interface Apply<A> extends Functor<A> {
ap<B>(fab: Apply<(a: A) => B>): Apply<B>;
}
declare module "data.maybe" {
declare class Functor<A> {
map<B>(f: (a: A) => B): Functor<B>;
}

interface Applicative<A> extends Apply<A> {
static of<B>(b: B): Applicative<B>;
}
declare class Apply<A> extends Functor<A> {
ap<B>(fab: Apply<(a: A) => B>): Apply<B>;
}

interface Chain<A> extends Apply<A> {
chain<B>(f: (a: A) => Chain<B>): Chain<B>;
}
declare class Applicative<A> extends Apply<A> {
static of<B>(b: B): Applicative<B>;
}

interface Monad<A> extends Applicative<A>, Chain<A> {}
declare class Chain<A> extends Apply<A> {
chain<B>(f: (a: A) => Chain<B>): Chain<B>;
}
declare interface Monad<A> extends Applicative<A>, Chain<A> {}

interface Validation<F, S> extends Applicative<S> {}
declare class Validation<F, S> extends Applicative<S> {}

declare module "data.maybe" {
declare class IMaybe<T> {
isNothing: boolean;
isJust: boolean;
Expand Down

0 comments on commit 9bc721a

Please sign in to comment.