/*! * Copyright (c) 2017 by The Funfix Project Developers. * Some rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* @flow */ import type { Throwable } from "funfix-core" import { Option, Try, Either } from "funfix-core" import { Future } from "funfix-exec" import { Eval, IO } from "funfix-effect" import { HK } from "./kinds" export type OptionK = HK, A>; declare export class OptionInstances { eqv(lh: Option, rh: Option): boolean; pure(a: A): Option; unit(): Option; ap(fa: OptionK, ff: OptionK<(a: A) => B>): Option; map(fa: OptionK, f: (a: A) => B): Option; map2(fa: OptionK, fb: OptionK, f: (a: A, b: B) => Z): Option; product(fa: OptionK, fb: OptionK): Option<[A, B]>; flatMap(fa: OptionK, f: (a: A) => OptionK): Option; tailRecM(a: A, f: (a: A) => OptionK>): Option; coflatMap(fa: OptionK, ff: (a: OptionK) => B): Option; coflatten(fa: OptionK): Option>; followedBy(fa: OptionK, fb: OptionK): Option; followedByL(fa: OptionK, fb: () => OptionK): Option; forEffect(fa: OptionK, fb: OptionK): Option; forEffectL(fa: OptionK, fb: () => OptionK): Option; static global: OptionInstances; } export type TryK = HK, A>; declare export class TryInstances { eqv(lh: Try, rh: Try): boolean; pure(a: A): Try; unit(): Try; ap(fa: TryK, ff: TryK<(a: A) => B>): Try; map(fa: TryK, f: (a: A) => B): Try; map2(fa: TryK, fb: TryK, f: (a: A, b: B) => Z): Try; product(fa: TryK, fb: TryK): Try<[A, B]>; flatMap(fa: TryK, f: (a: A) => TryK): Try; tailRecM(a: A, f: (a: A) => TryK>): Try; coflatMap(fa: TryK, ff: (a: TryK) => B): Try; coflatten(fa: TryK): Try>; followedBy(fa: TryK, fb: TryK): Try; followedByL(fa: TryK, fb: () => TryK): Try; forEffect(fa: TryK, fb: TryK): Try; forEffectL(fa: TryK, fb: () => TryK): Try; raise(e: Throwable): Try; attempt(fa: TryK): Try>; recoverWith(fa: TryK, f: (e: Throwable) => TryK): Try; recover(fa: TryK, f: (e: Throwable) => A): Try; static global: TryInstances; } export type EitherK = HK, R>; declare export class EitherInstances { eqv(lh: Either, rh: Either): boolean; pure(a: A): Either; unit(): Either; ap(fa: EitherK, ff: EitherK B>): Either; map(fa: EitherK, f: (a: A) => B): Either; map2(fa: EitherK, fb: EitherK, f: (a: A, b: B) => Z): Either; product(fa: EitherK, fb: EitherK): Either; flatMap(fa: EitherK, f: (a: A) => EitherK): Either; tailRecM(a: A, f: (a: A) => EitherK>): Either; coflatMap(fa: EitherK, ff: (a: EitherK) => B): Either; coflatten(fa: EitherK): Either>; followedBy(fa: EitherK, fb: EitherK): Either; followedByL(fa: EitherK, fb: () => EitherK): Either; forEffect(fa: EitherK, fb: EitherK): Either; forEffectL(fa: EitherK, fb: () => EitherK): Either; static global: EitherInstances; } export type EvalK = HK, A>; declare export class EvalInstances { pure(a: A): Eval; unit(): Eval; ap(fa: EvalK, ff: EvalK<(a: A) => B>): Eval; map(fa: EvalK, f: (a: A) => B): Eval; map2(fa: EvalK, fb: EvalK, f: (a: A, b: B) => Z): Eval; product(fa: EvalK, fb: EvalK): Eval<[A, B]>; flatMap(fa: EvalK, f: (a: A) => EvalK): Eval; tailRecM(a: A, f: (a: A) => EvalK>): Eval; followedBy(fa: EvalK, fb: EvalK): Eval; followedByL(fa: EvalK, fb: () => EvalK): Eval; forEffect(fa: EvalK, fb: EvalK): Eval; forEffectL(fa: EvalK, fb: () => EvalK): Eval; coflatMap(fa: EvalK, ff: (a: EvalK) => B): Eval; coflatten(fa: EvalK): Eval>; extract(fa: EvalK): A; static global: EvalInstances; } export type FutureK = HK, A>; declare export class FutureInstances { pure(a: A): Future; flatMap(fa: FutureK, f: (a: A) => FutureK): Future; tailRecM(a: A, f: (a: A) => FutureK>): Future; ap(fa: FutureK, ff: FutureK<(a: A) => B>): Future; map(fa: FutureK, f: (a: A) => B): Future; unit(): Future; raise(e: Throwable): Future; attempt(fa: FutureK): Future>; recoverWith(fa: FutureK, f: (e: Throwable) => FutureK): Future; recover(fa: FutureK, f: (e: Throwable) => A): Future; coflatMap(fa: FutureK, ff: (a: FutureK) => B): Future; coflatten(fa: FutureK): Future>; map2: (fa: FutureK, fb: FutureK, f: (a: A, b: B) => Z) => Future; product: (fa: FutureK, fb: FutureK) => FutureK<[A, B]>; followedBy: (fa: FutureK, fb: FutureK) => Future; followedByL: (fa: FutureK, fb: () => FutureK) => Future; forEffect: (fa: FutureK, fb: FutureK) => Future; forEffectL: (fa: FutureK, fb: () => FutureK) => Future; static global: FutureInstances; } export type IOK = HK, A>; declare export class IOInstances { pure(a: A): IO; flatMap(fa: IOK, f: (a: A) => IOK): IO; tailRecM(a: A, f: (a: A) => IOK>): IO; ap(fa: IOK, ff: IOK<(a: A) => B>): IO; map(fa: IOK, f: (a: A) => B): IO; unit(): IO; raise(e: Throwable): IO; attempt(fa: IOK): IO>; recoverWith(fa: IOK, f: (e: Throwable) => IOK): IO; recover(fa: IOK, f: (e: Throwable) => A): IO; coflatMap(fa: IOK, ff: (a: IOK) => B): IO; coflatten(fa: IOK): IO>; map2: (fa: IOK, fb: IOK, f: (a: A, b: B) => Z) => IO; product: (fa: IOK, fb: IOK) => IOK<[A, B]>; followedBy: (fa: IOK, fb: IOK) => IO; followedByL: (fa: IOK, fb: () => IOK) => IO; forEffect: (fa: IOK, fb: IOK) => IO; forEffectL: (fa: IOK, fb: () => IOK) => IO; static global: IOInstances; }