Integer overview
This module implements a CVInteger brand, i.e. a number that represents an integer (Infinity, NaN disallowed). Can be used to represent a floor in a lift, a signed quantity… See the Effect
documentation about Branding (https://effect.website/docs/code-style/branded-types/) if you are not familiar with this concept.
Table of contents
Constructors
fromBigDecimal
Tries to construct a CVInteger
from a BigDecimal
. Returns a Right
if the conversion can be performed, a Left
otherwise
Signature
export declare const fromBigDecimal: MTypes.OneArgFunction<
BigDecimal.BigDecimal,
Either.Either<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>, Brand.Brand.BrandErrors>
>
fromBigDecimalOption
Tries to construct a CVInteger
from a BigDecimal
. Returns a Some
if the conversion can be performed, a None
otherwise
Signature
export declare const fromBigDecimalOption: MTypes.OneArgFunction<
BigDecimal.BigDecimal,
Option.Option<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>>
>
fromBigDecimalOrThrow
Constructs a CVInteger
from a BigDecimal
if possible. Throws otherwise
Signature
export declare const fromBigDecimalOrThrow: MTypes.OneArgFunction<
BigDecimal.BigDecimal,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
fromBigInt
Tries to construct a CVInteger
from a BigInt
. Returns a Right
if the conversion can be performed, a Left
otherwise
Signature
export declare const fromBigInt: MTypes.OneArgFunction<
bigint,
Either.Either<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>, Brand.Brand.BrandErrors>
>
fromBigIntOption
Tries to construct a CVInteger
from a BigInt
. Returns a Some
if the conversion can be performed, a None
otherwise
Signature
export declare const fromBigIntOption: MTypes.OneArgFunction<
bigint,
Option.Option<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>>
>
fromBigIntOrThrow
Constructs a CVInteger
from a BigInt
if possible. Throws otherwise
Signature
export declare const fromBigIntOrThrow: MTypes.OneArgFunction<
bigint,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
fromNumber
Tries to construct a CVnteger
from a number. Returns a Right
if the conversion can be performed, a Left
otherwise
Signature
export declare const fromNumber: MTypes.OneArgFunction<
number,
Either.Either<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>, Brand.Brand.BrandErrors>
>
fromNumberOption
Tries to construct a CVInteger
from a number. Returns a Some
if the conversion can be performed, a None
otherwise
Signature
export declare const fromNumberOption: MTypes.OneArgFunction<
number,
Option.Option<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>>
>
fromNumberOrThrow
Constructs a CVInteger
from a number if possible. Throws otherwise
Signature
export declare const fromNumberOrThrow: MTypes.OneArgFunction<
number,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
fromReal
Tries to construct a CVInteger
from a CVReal
. Returns a Right
if the conversion can be performed, a Left
otherwise
Signature
export declare const fromReal: MTypes.OneArgFunction<
CVReal.Type,
Either.Either<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>, Brand.Brand.BrandErrors>
>
fromRealOption
Tries to construct a CVInteger
from a CVReal
. Returns a Some
if the conversion can be performed, a None
otherwise
Signature
export declare const fromRealOption: MTypes.OneArgFunction<
CVReal.Type,
Option.Option<number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>>
>
fromRealOrThrow
Constructs a CVInteger
from a CVReal
if possible. Throws otherwise
Signature
export declare const fromRealOrThrow: MTypes.OneArgFunction<
CVReal.Type,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
unsafeFromBigDecimal
Constructs a CVInteger
from a BigDecimal
without any checks
Signature
export declare const unsafeFromBigDecimal: MTypes.OneArgFunction<
BigDecimal.BigDecimal,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
unsafeFromBigInt
Constructs a CVInteger
from a BigInt
without any checks
Signature
export declare const unsafeFromBigInt: MTypes.OneArgFunction<
bigint,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
unsafeFromNumber
Constructs a CVInteger
from a number without any verifications
Signature
export declare const unsafeFromNumber: Brand.Brand.Constructor<
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
unsafeFromReal
Constructs a CVInteger
from a CVReal
without any checks
Signature
export declare const unsafeFromReal: MTypes.OneArgFunction<
CVReal.Type,
number & Brand.Brand<typeof CVReal.TypeId> & Brand.Brand<typeof CVInt._TypeId>
>
Models
Type (type alias)
CVInteger
type
Signature
export type Type = Brand.Brand.FromConstructor<typeof constructor>
Module markers
moduleTag
Module tag
Signature
export declare const moduleTag: "@parischap/conversions/Integer/"