FsControl icon indicating copy to clipboard operation
FsControl copied to clipboard

Numeric code needs redesign (II).

Open gusty opened this issue 9 years ago • 0 comments

First redesign was a first step to get a more F#ish Numeric module. However many areas were not considered, specifically:

1a) Interaction with arbitrary .NET math operation like DateTime subtraction 1b) Units of measure 2) Integration with F# generic functions like Seq.average which requires a DivideByInt method. 3) Performance of try/safe functions.

Possible solutions:

Implement two set of math operations, a flexible set which will allow adding a TimeSpan to a DateTime and multiply/divide int<m/s> by int<s> and a strict version which will rely in the generic number literals.

Libraries can present modules which will allow to switch (by opening them) between one mode or another.

Integration with existing F# generic functions is probably not possible without redefining those functions, so that alternative should be explored.

Additionally the try/safe-functions use a Result of Exception type, which doesn't throw but eagerly write Exceptions. This could be encoded with a double barrelled CPS version, so implementations of try-versions (option type) will not suffer such performance penalties.

gusty avatar Oct 15 '16 10:10 gusty