Function
Instances
Lagacy
Utilities
Endomorphism(deprecated)- FunctionN
- LazyArg
Predicate(deprecated)Refinement(deprecated)- SK
- absurd
- apply
- constFalse
- constNull
- constTrue
- constUndefined
- constVoid
- constant
- decrement
- flip
- flow
getEndomorphismMonoid(deprecated)- hole
- identity
- increment
not(deprecated)- pipe
- tuple
- tupled
- unsafeCoerce
- untupled
Instances
getBooleanAlgebra
Signature
export declare const getBooleanAlgebra: <B>(B: BooleanAlgebra<B>) => <A = never>() => BooleanAlgebra<(a: A) => B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
getMonoid
Unary functions form a monoid as long as you can provide a monoid for the codomain.
Signature
export declare const getMonoid: <M>(M: Monoid<M>) => <A = never>() => Monoid<(a: A) => M>
Details
- Added in 0.1.0
Example
import { Predicate } from '@fp-tx/core/Predicate'
import { getMonoid } from '@fp-tx/core/function'
import * as B from '@fp-tx/core/boolean'
const f: Predicate<number> = n => n <= 2
const g: Predicate<number> = n => n >= 0
const M1 = getMonoid(B.MonoidAll)<number>()
assert.deepStrictEqual(M1.concat(f, g)(1), true)
assert.deepStrictEqual(M1.concat(f, g)(3), false)
const M2 = getMonoid(B.MonoidAny)<number>()
assert.deepStrictEqual(M2.concat(f, g)(1), true)
assert.deepStrictEqual(M2.concat(f, g)(3), true)
License
- MIT – Copyright (c) 2017-present Giulio Canti
getRing
Signature
export declare const getRing: <A, B>(R: Ring<B>) => Ring<(a: A) => B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
getSemigroup
Unary functions form a semigroup as long as you can provide a semigroup for the codomain.
Signature
export declare const getSemigroup: <S>(S: Semigroup<S>) => <A = never>() => Semigroup<(a: A) => S>
Details
- Added in 0.1.0
Example
import { Predicate, getSemigroup } from '@fp-tx/core/function'
import * as B from '@fp-tx/core/boolean'
const f: Predicate<number> = n => n <= 2
const g: Predicate<number> = n => n >= 0
const S1 = getSemigroup(B.SemigroupAll)<number>()
assert.deepStrictEqual(S1.concat(f, g)(1), true)
assert.deepStrictEqual(S1.concat(f, g)(3), false)
const S2 = getSemigroup(B.SemigroupAny)<number>()
assert.deepStrictEqual(S2.concat(f, g)(1), true)
assert.deepStrictEqual(S2.concat(f, g)(3), true)
License
- MIT – Copyright (c) 2017-present Giulio Canti
getSemiring
Signature
export declare const getSemiring: <A, B>(S: Semiring<B>) => Semiring<(a: A) => B>
Details
- Added in 0.1.0
License
- MIT – Copyright (c) 2017-present Giulio Canti
Lagacy
Lazy
Use LazyArg
instead.