/*! * Copyright (c) 2017-2018 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 { HK, Monad } from "funland" import { Either } from "funfix-core" declare export class Eval<+A> { get(): A; map(f: (a: A) => B): Eval; flatMap(f: (a: A) => Eval): Eval; chain(f: (a: A) => Eval): Eval; ap(ff: Eval<(a: A) => B>): Eval; memoize(): Eval; forEachL(cb: (a: A) => void): Eval; forEach(cb: (a: A) => void): void; static +_Class: Eval; static of(thunk: () => A): Eval; static pure(value: A): Eval; static now(value: A): Eval; static unit(): Eval; static always(thunk: () => A): Eval; static once(thunk: () => A): Eval; static suspend(thunk: () => Eval): Eval; static defer(thunk: () => Eval): Eval; static tailRecM(a: A, f: (a: A) => Eval>): Eval; static sequence(list: Iterable>): Eval; static map2(fa1: Eval, fa2: Eval, f: (a1: A1, a2: A2) => R): Eval; static map3(fa1: Eval, fa2: Eval, fa3: Eval, f: (a1: A1, a2: A2, a3: A3) => R): Eval; static map4(fa1: Eval, fa2: Eval, fa3: Eval, fa4: Eval, f: (a1: A1, a2: A2, a3: A3, a4: A4) => R): Eval; static map5(fa1: Eval, fa2: Eval, fa3: Eval, fa4: Eval, fa5: Eval, f: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => R): Eval; static map6(fa1: Eval, fa2: Eval, fa3: Eval, fa4: Eval, fa5: Eval, fa6: Eval, f: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => R): Eval; } export type EvalURI = (x: [U, L, A]) => Eval; export type EvalK = HK; export type EvalTypes = Monad; declare export var EvalModule: EvalTypes;