- NumType <SELF, NUM, A>
- NumTypeExtensions
- Sum <SELF, NUM, A> (this IEnumerable<NumType<SELF, NUM, A>> self)
- Sum <SELF, NUM, A, PRED> (this IEnumerable<NumType<SELF, NUM, A, PRED>> self)
- NumType <SELF, NUM, A, PRED>
- Value
- New = IL.Ctor<A, SELF>()
- NewTry (A value)
- NewOption (A value)
- NumType (A value)
- GetObjectData (SerializationInfo info, StreamingContext context)
- Plus (SELF rhs)
- Subtract (SELF rhs)
- Divide (SELF rhs)
- Product (SELF rhs)
- Abs ()
- Signum ()
- Min (SELF rhs)
- Max (SELF rhs)
- CompareTo (SELF? other)
- Equals (SELF? other)
- Equals (SELF other, SELF epsilon)
- Equals (object? obj)
- GetHashCode ()
- CompareTo (object? obj)
- - (NumType<SELF, NUM, A, PRED> x)
- + (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- - (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- * (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- / (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- == (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- != (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- > (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- >= (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- < (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- <= (NumType<SELF, NUM, A, PRED> lhs, NumType<SELF, NUM, A, PRED> rhs)
- Bind (Func<A, SELF> bind)
- Exists (Func<A, bool> predicate)
- ForAll (Func<A, bool> predicate)
- Map (Func<A, A> map)
- Select (Func<A, A> map)
- SelectMany ( Func<A, NumType<SELF, NUM, A, PRED>> bind, Func<A, A, A> project)
- Iter (Action<A> f)
- ToString ()
- Fold <S> (S state, Func<S, A, S> folder)
- FoldBack <S> (S state, Func<S, A, S> folder)
- Sum ()
- FromInteger (int value)
- Prelude
- bind <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, NUMTYPE> bind)
- iter <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Action<T> f)
- count <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value)
- exists <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, bool> predicate)
- forall <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, bool> predicate)
- map <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, T> map)
- add <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y)
- subtract <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y)
- product <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y)
- divide <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y)
- sum <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> self)
- bind <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, NUMTYPE> bind)
- iter <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Action<T> f)
- count <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value)
- exists <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, bool> predicate)
- forall <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, bool> predicate)
- map <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, T> map)
- add <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y)
- subtract <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y)
- product <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y)
- divide <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y)
- sum <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> self)
class NumType <SELF, NUM, A> Source #
NumType - inspired by Haskell's 'newtype' keyword. This is setup for numeric types,and expects a Num class-instance as an argument (TInt, TDouble, etc.)
Derive type from this one to get: Equatable, Comparable, Appendable, Foldable, Functor, Iterable: strongly typed values.
For example:
class Metres : NumType<Metres, TDouble, double> { public Metres(double x) : base(x) {} }
Will not accept null values
type | SELF | Self reference type - i.e. class Metres : NumType<Metres, ... > |
type | NUM | Num of A, e.g. TInt, TDouble, TFloat, etc. |
type | A | Bound value type |
method void GetObjectData (SerializationInfo info, StreamingContext context) Source #
class NumTypeExtensions Source #
class NumType <SELF, NUM, A, PRED> Source #
NumType - inspired by Haskell's 'newtype' keyword. This is setup for numeric types,and expects a Num class-instance as an argument (TInt, TDouble, etc.)
Derive type from this one to get: Equatable, Comparable, Appendable, Foldable, Functor, Iterable: strongly typed values.
For example:
class Metres : NumType<Metres, TDouble, double> { public Metres(double x) : base(x) {} }
Will not accept null values
type | SELF | Self reference type - i.e. class Metres : NumType<Metres, ... > |
type | NUM | 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. |
method void GetObjectData (SerializationInfo info, StreamingContext context) Source #
method SELF Plus (SELF rhs) Source #
Sum of NumType(x) and NumType(y)
param | rhs | Right-hand side of the operation |
returns | lhs + rhs |
method SELF Subtract (SELF rhs) Source #
Subtract of NewType(x) and NewType(y)
param | rhs | Right-hand side of the operation |
returns | lhs - rhs |
method SELF Divide (SELF rhs) Source #
Divide NewType(x) and NewType(y)
param | rhs | Right-hand side of the operation |
returns | lhs / rhs |
method SELF Product (SELF rhs) Source #
Multiply NewType(x) and NewType(y)
param | rhs | Right-hand side of the operation |
returns | lhs * rhs |
Find the absolute value of a number
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
param | x | The value to find the sign of |
returns | -1, 0, or +1 |
method int GetHashCode () Source #
method SELF Bind (Func<A, SELF> bind) Source #
Monadic bind of the bound value to a new value of the same type
param | bind | Bind function |
method bool Exists (Func<A, bool> predicate) Source #
Run a predicate for all values in the NumType (only ever one)
method bool ForAll (Func<A, bool> predicate) Source #
Run a predicate for all values in the NumType (only ever one)
method SELF SelectMany ( Func<A, NumType<SELF, NUM, A, PRED>> bind, Func<A, A, A> project) Source #
Monadic bind of the bound value to a new value of the same type
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
param | f | Action to invoke |
method S Fold <S> (S state, Func<S, A, S> folder) Source #
Fold
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Folded state and NumType bound value |
method S FoldBack <S> (S state, Func<S, A, S> folder) Source #
Fold back
type | S | State type |
param | state | Initial state |
param | folder | Fold function |
returns | Folded state and NumType bound value |
method SELF FromInteger (int value) Source #
method NUMTYPE bind <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, NUMTYPE> bind) Source #
method Unit iter <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Action<T> f) Source #
method int count <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value) Source #
method bool exists <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, bool> predicate) Source #
method bool forall <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, bool> predicate) Source #
method NUMTYPE map <NUMTYPE, NUM, T, PRED> (NumType<NUMTYPE, NUM, T, PRED> value, Func<T, T> map) Source #
method NUMTYPE add <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y) Source #
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)
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 NUMTYPE subtract <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y) Source #
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)
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 NUMTYPE product <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y) Source #
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)
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 NUMTYPE divide <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> x, NUMTYPE y) Source #
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)
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 <NUMTYPE, NUM, A, PRED> (NumType<NUMTYPE, NUM, A, PRED> self) Source #
method NUMTYPE bind <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, NUMTYPE> bind) Source #
method Unit iter <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Action<T> f) Source #
method int count <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value) Source #
method bool exists <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, bool> predicate) Source #
method bool forall <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, bool> predicate) Source #
method NUMTYPE map <NUMTYPE, NUM, T> (NumType<NUMTYPE, NUM, T> value, Func<T, T> map) Source #
method NUMTYPE add <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y) Source #
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)
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 NUMTYPE subtract <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y) Source #
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)
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 NUMTYPE product <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y) Source #
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)
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 NUMTYPE divide <NUMTYPE, NUM, A> (NumType<NUMTYPE, NUM, A> x, NUMTYPE y) Source #
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)
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 |