LanguageExt.Core

LanguageExt.Core DataTypes New Types FloatType

Contents

class FloatType <SELF, FLOATING, A> Source #

where FLOATING : Floating<A>
where SELF : FloatType<SELF, FLOATING, A>

FloatType - inspired by Haskell's 'newtype' keyword. This is setup for floating point numeric types,and expects a Floating class-instance as an argument (TFloat, TDouble, TDecimal, etc.)

wiki.haskell.org/Newtype

Derive type from this one to get: Equatable, Comparable, Appendable, Foldable, Functor, Iterable: strongly typed values.

For example:

class Metres : FloatType<Metres, TDouble, double> { public Metres(double x) : base(x) {} }

Will not accept null values

Parameters

type SELF

Self reference type - i.e. class Metres : FloatType<Metres, ... >

type FLOATING

Floating of A, e.g. TDouble, TFloat, etc.

type A

Bound value type

Constructors

constructor FloatType (A value) Source #

Constructor

Parameters

param value

Value to bind

Methods

method void GetObjectData (SerializationInfo info, StreamingContext context) Source #

class FloatTypeExtensions Source #

Methods

method SELF Sum <SELF, FLOATING, A> (this IEnumerable<FloatType<SELF, FLOATING, A>> self) Source #

where FLOATING : Floating<A>
where SELF : FloatType<SELF, FLOATING, A>

method SELF Sum <SELF, FLOATING, A, PRED> (this IEnumerable<FloatType<SELF, FLOATING, A, PRED>> self) Source #

where FLOATING : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOATING, A, PRED>

class FloatType <SELF, FLOATING, A, PRED> Source #

where FLOATING : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOATING, A, PRED>

FloatType - inspired by Haskell's 'newtype' keyword. This is setup for floating point numeric types,and expects a Floating class-instance as an argument (TFloat, TDouble, TDecimal, etc.)

https://wiki.haskell.org/Newtype

Derive type from this one to get: Equatable, Comparable, Appendable, Foldable, Functor, Iterable: strongly typed values.

For example:

class Metres : FloatType<Metres, TDouble, double> { public Metres(double x) : base(x) {} }

Will not accept null values

Parameters

type SELF

Self reference type - i.e. class Metres : FloatType<Metres, ... >

type FLOATING

Num of A, e.g. TInt, TDouble, TFloat, etc.

type A

Bound value type

type PRED

A predicate to be applied to the value passed into the constructor. Allows for constraints on the value stored.

Fields

field A Value Source #

field Func<A, SELF> New = IL.Ctor<A, SELF>() Source #

Constructor function

Constructors

constructor FloatType (A value) Source #

Constructor

Parameters

param value

Value to bind

Methods

method Option<SELF> NewOption (A value) Source #

Optional new

method Fin<SELF> NewTry (A value) Source #

Try new

method void GetObjectData (SerializationInfo info, StreamingContext context) Source #

method SELF Plus (SELF rhs) Source #

Sum of FloatType(x) and FloatType(y)

Parameters

param rhs

Right-hand side of the operation

returns

lhs + rhs

method SELF Subtract (SELF rhs) Source #

Subtract of NewType(x) and NewType(y)

Parameters

param rhs

Right-hand side of the operation

returns

lhs - rhs

method SELF Divide (SELF rhs) Source #

Divide NewType(x) and NewType(y)

Parameters

param rhs

Right-hand side of the operation

returns

lhs / rhs

method SELF Product (SELF rhs) Source #

Multiply NewType(x) and NewType(y)

Parameters

param rhs

Right-hand side of the operation

returns

lhs * rhs

method SELF Abs () Source #

Find the absolute value of a number

Parameters

param x

The value to find the absolute value of

returns

The non-negative absolute value of x

method SELF Signum () Source #

Find the sign of x

Parameters

param x

The value to find the sign of

returns

-1, 0, or +1

method SELF Min (SELF rhs) Source #

Find the minimum value between this and rhs

method SELF Max (SELF rhs) Source #

Find the maximum value between this and rhs

method SELF Exp () Source #

The exponential function.

Parameters

param x

The value for which we are calculating the exponential

returns

method SELF Sqrt () Source #

Calculates the square root of a value.

Parameters

param x

The value for which we are calculating the square root.

returns

.

method SELF Log () Source #

Calculates the natural logarithm of a value.

Parameters

param x

The value for which we are calculating the natural logarithm.

returns

.

method SELF Pow (A exp) Source #

Raises x to the power y

Parameters

param x

The base to be raised to y

param exp

The exponent to which we are raising x

returns

.

method SELF LogBase (A y) Source #

Calculates the logarithm of a value with respect to an arbitrary base.

Parameters

param x

The base to use for the logarithm of t

param y

The value for which we are calculating the logarithm.

returns

.

method SELF Sin () Source #

Calculates the sine of an angle.

Parameters

param x

An angle, in radians

returns

method SELF Cos () Source #

Calculates the cosine of an angle.

Parameters

param x

An angle, in radians

returns

method SELF Tan () Source #

Calculates the tangent of an angle.

Parameters

param x

An angle, in radians

returns

method SELF Asin () Source #

Calculates an arcsine.

Parameters

param x

The value for which an arcsine is to be calculated.

returns

, in radians.

method SELF Acos () Source #

Calculates an arc-cosine.

Parameters

param x

The value for which an arc-cosine is to be calculated

returns

, in radians

method SELF Atan () Source #

Calculates an arc-tangent.

Parameters

param x

The value for which an arc-tangent is to be calculated

returns

, in radians

method SELF Sinh () Source #

Calculates a hyperbolic sine.

Parameters

param x

The value for which a hyperbolic sine is to be calculated

returns

method SELF Cosh () Source #

Calculates a hyperbolic cosine.

Parameters

param x

The value for which a hyperbolic cosine is to be calculated

returns

method SELF Tanh () Source #

Calculates a hyperbolic tangent.

Parameters

param x

The value for which a hyperbolic tangent is to be calculated.

returns

method SELF Asinh () Source #

Calculates an area hyperbolic sine

Parameters

param x

The value for which an area hyperbolic sine is to be calculated.

returns

.

method SELF Acosh () Source #

Calculates an area hyperbolic cosine.

Parameters

param x

The value for which an area hyperbolic cosine is to be calculated.

returns

.

method SELF Atanh () Source #

Calculates an area hyperbolic tangent.

Parameters

param x

The value for which an area hyperbolic tangent is to be calculated.

returns

method int CompareTo (SELF? other) Source #

Compare this to other

method bool Equals (SELF? other) Source #

Equality test between this and other

method bool Equals (SELF other, SELF epsilon) Source #

Equality test between this and other

method bool Equals (object? obj) Source #

Equality test between this and other

method int GetHashCode () Source #

Get the hash-code of the bound value

Parameters

returns

method int CompareTo (object? obj) Source #

method SELF Bind (Func<A, SELF> bind) Source #

Monadic bind of the bound value to a new value of the same type

Parameters

param bind

Bind function

method bool Exists (Func<A, bool> predicate) Source #

Run a predicate for all values in the FloatType (only ever one)

method bool ForAll (Func<A, bool> predicate) Source #

Run a predicate for all values in the FloatType (only ever one)

method SELF Map (Func<A, A> map) Source #

Map the bound value to a new value of the same type

method SELF Select (Func<A, A> map) Source #

Map the bound value to a new value of the same type

method SELF SelectMany ( Func<A, FloatType<SELF, FLOATING, A, PRED>> bind, Func<A, A, A> project) Source #

Monadic bind of the bound value to a new value of the same type

Parameters

param bind

Bind function

param project

Final projection (select)

method Unit Iter (Action<A> f) Source #

Invoke an action that takes the bound value as an argument

Parameters

param f

Action to invoke

method string ToString () Source #

Generate a text representation of the FloatType and value

method S Fold <S> (S state, Func<S, A, S> folder) Source #

Fold

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state and FloatType bound value

method S FoldBack <S> (S state, Func<S, A, S> folder) Source #

Fold back

Parameters

type S

State type

param state

Initial state

param folder

Fold function

returns

Folded state and FloatType bound value

method SELF FromInteger (int value) Source #

Operators

operator - (FloatType<SELF, FLOATING, A, PRED> x) Source #

operator + (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator - (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator * (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator / (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator == (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator != (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator > (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator >= (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator < (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

operator <= (FloatType<SELF, FLOATING, A, PRED> lhs, FloatType<SELF, FLOATING, A, PRED> rhs) Source #

class Prelude Source #

Methods

method SELF bind <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value, Func<T, SELF> bind) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method Unit iter <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value, Action<T> f) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method int count <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method bool exists <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value, Func<T, bool> predicate) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method bool forall <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value, Func<T, bool> predicate) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method SELF map <SELF, FLOAT, T, PRED> (FloatType<SELF, FLOAT, T, PRED> value, Func<T, T> map) Source #

where FLOAT : Floating<T>
where PRED : Pred<T>
where SELF : FloatType<SELF, FLOAT, T, PRED>

method SELF add <SELF, FLOAT, A, PRED> (FloatType<SELF, FLOAT, A, PRED> x, SELF y) Source #

where FLOAT : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOAT, A, PRED>

Add the bound values of x and y, uses an Add trait to provide the add operation for type A. For example x.Add<Metres, TInt, int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

An NewType with y added to x

method SELF subtract <SELF, FLOAT, A, PRED> (FloatType<SELF, FLOAT, A, PRED> x, SELF y) Source #

where FLOAT : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOAT, A, PRED>

Find the subtract between the two bound values of x and y, uses a Subtract trait to provide the subtract operation for type A. For example x.Subtract<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

An NewType with the subtract between x and y

method SELF product <SELF, FLOAT, A, PRED> (FloatType<SELF, FLOAT, A, PRED> x, SELF y) Source #

where FLOAT : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOAT, A, PRED>

Find the product between the two bound values of x and y, uses a Product trait to provide the product operation for type A. For example x.Product<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

Product of x and y

method SELF divide <SELF, FLOAT, A, PRED> (FloatType<SELF, FLOAT, A, PRED> x, SELF y) Source #

where FLOAT : Floating<A>
where PRED : Pred<A>
where SELF : FloatType<SELF, FLOAT, A, PRED>

Find the product between the two bound values of x and y, uses a Product trait to provide the product operation for type A. For example x.Product<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

Product of x and y

method A sum <SELF, FLOAT, A, PRED> (FloatType<SELF, FLOAT, A, PRED> self) Source #

where SELF : FloatType<SELF, FLOAT, A, PRED>
where PRED : Pred<A>
where FLOAT : Floating<A>

method SELF bind <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value, Func<T, SELF> bind) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method Unit iter <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value, Action<T> f) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method int count <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method bool exists <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value, Func<T, bool> predicate) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method bool forall <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value, Func<T, bool> predicate) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method SELF map <SELF, FLOAT, T> (FloatType<SELF, FLOAT, T> value, Func<T, T> map) Source #

where FLOAT : Floating<T>
where SELF : FloatType<SELF, FLOAT, T>

method SELF add <SELF, FLOAT, A> (FloatType<SELF, FLOAT, A> x, SELF y) Source #

where FLOAT : Floating<A>
where SELF : FloatType<SELF, FLOAT, A>

Add the bound values of x and y, uses an Add trait to provide the add operation for type A. For example x.Add<Metres, TInt, int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

An NewType with y added to x

method SELF subtract <SELF, FLOAT, A> (FloatType<SELF, FLOAT, A> x, SELF y) Source #

where FLOAT : Floating<A>
where SELF : FloatType<SELF, FLOAT, A>

Find the subtract between the two bound values of x and y, uses a Subtract trait to provide the subtract operation for type A. For example x.Subtract<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

An NewType with the subtract between x and y

method SELF product <SELF, FLOAT, A> (FloatType<SELF, FLOAT, A> x, SELF y) Source #

where FLOAT : Floating<A>
where SELF : FloatType<SELF, FLOAT, A>

Find the product between the two bound values of x and y, uses a Product trait to provide the product operation for type A. For example x.Product<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

Product of x and y

method SELF divide <SELF, FLOAT, A> (FloatType<SELF, FLOAT, A> x, SELF y) Source #

where FLOAT : Floating<A>
where SELF : FloatType<SELF, FLOAT, A>

Find the product between the two bound values of x and y, uses a Product trait to provide the product operation for type A. For example x.Product<TInteger,int>(y)

Parameters

type A

Bound value type

param x

Left hand side of the operation

param y

Right hand side of the operation

returns

Product of x and y