Skip to main content
Module

x/fun/predicate.ts>getSemigroupAny

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 getSemigroupAny
import { getSemigroupAny } 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 or function.

Examples

Example 1

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

const SemigroupAny = getSemigroupAny<number>();

const lessThanZero = (n: number) => n < 0;
const greaterThanFifty = (n: number) => n > 50;

const notBetweenZeroAndFifty = pipe(
  lessThanZero,
  SemigroupAny.concat(greaterThanFifty),
);

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

Type Parameters

optional
A = never