Skip to main content
Module

x/fun/predicate.ts>getSemigroupAll

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function getSemigroupAll
import { getSemigroupAll } from "https://deno.land/x/fun@v2.0.0-alpha.10/predicate.ts";

Get a Semigroup<Predicate> for any type A that concats using the Predicate and function.

Examples

Example 1

import { getSemigroupAll } from "./predicate.ts";
import { pipe } from "./fn.ts";

const SemigroupAll = getSemigroupAll<number>();

const greaterThanZero = (n: number) => n > 0;
const lessThanFifty = (n: number) => n < 50;

const betweenZeroAndFifty = pipe(
  greaterThanZero,
  SemigroupAll.concat(lessThanFifty),
);

const result1 = betweenZeroAndFifty(10); // true
const result2 = betweenZeroAndFifty(-10); // false
const result3 = betweenZeroAndFifty(100); // false

Type Parameters

optional
A = never