VS
Size: a a a
VS
VS
VS
SN
SN
SN
SN
[<SuppressMessage("*", "TypeNames")>]
type posint = private Posint of int
with
static member OfInt =
Constrain.constrain (fun (n : int) ->
if n > 0
then Success (Posint n)
else failf "Expected positive int, received %d" n)
member this.Value = let (Posint v) = this in v
// posint & int
static member (+) (Posint p1, p2 : int) = p1 + p2
static member (+) (p1 : int, Posint p2) = p1 + p2
static member (*) (Posint p1, p2 : int) = p1 * p2
static member (*) (p1 : int, Posint p2) = p1 * p2
static member (-) (Posint p1, p2 : int) = p1 - p2
static member (-) (p1 : int, Posint p2) = p1 - p2
static member (/) (Posint p1, p2 : int) = p1 / p2
static member (/) (p1 : int, Posint p2) = p1 / p2
// posint & posint
static member (+) (Posint p1, Posint p2) = Posint (p1 + p2)
static member (-) (Posint p1, Posint p2) = p1 - p2
static member (*) (Posint p1, Posint p2) = Posint (p1 * p2)
static member (/) (Posint p1, Posint p2) = Posintz (p1 / p2)
// posint & posintz
static member (+) (Posint p1, Posintz p2) = Posint (p1 + p2)
static member (-) (Posint p1, Posintz p2) = p1 - p2
static member (*) (Posint p1, Posintz p2) = Posintz (p1 * p2)
static member (/) (Posint p1, Posintz p2) = Posintz (p1 / p2)
// posint & negint
static member (+) (Posint p1, Negint p2) = p1 + p2
static member (-) (Posint p1, Negint p2) = Posint (p1 - p2)
static member (*) (Posint p1, Negint p2) = Negint (p1 * p2)
static member (/) (Posint p1, Negint p2) = Negintz (p1 / p2)
// posint & negintz
static member (+) (Posint p1, Negintz p2) = p1 + p2
static member (-) (Posint p1, Negintz p2) = Posint (p1 - p2)
static member (*) (Posint p1, Negintz p2) = Negintz (p1 * p2)
static member (/) (Posint p1, Negintz p2) = Negintz (p1 / p2)
and
[<SuppressMessage("*", "TypeNames")>]
posintz = private Posintz of int
with
static member OfInt =
Constrain.constrain (fun (n : int) ->
if n >= 0
then Success (Posintz n)
else failf "Expected non-negative int, received %d" n)
member this.Value = let (Posintz v) = this in v
// posintz & int
static member (+) (Posintz p1, p2 : int) = p1 + p2
static member (+) (p1 : int, Posintz p2) = p1 + p2
static member (*) (Posintz p1, p2 : int) = p1 * p2
static member (*) (p1 : int, Posintz p2) = p1 * p2
static member (-) (Posintz p1, p2 : int) = p1 - p2
static member (-) (p1 : int, Posintz p2) = p1 - p2
static member (/) (Posintz p1, p2 : int) = p1 / p2
static member (/) (p1 : int, Posintz p2) = p1 / p2
// posintz & posintz
static member (+) (Posintz p1, Posintz p2) = Posintz (p1 + p2)
static member (-) (Posintz p1, Posintz p2) = p1 - p2
static member (*) (Posintz p1, Posintz p2) = Posintz (p1 * p2)
static member (/) (Posintz p1, Posintz p2) = Posintz (p1 / p2)
// posintz & posint
static member (+) (Posintz p1, Posint p2) = Posint (p1 + p2)
static member (-) (Posintz p1, Posint p2) = p1 - p2
static member (*) (Posintz p1, Posint p2) = Posintz (p1 * p2)
static member (/) (Posintz p1, Posint p2) = Posintz (p1 / p2)
// posintz & negint
static member (+) (Posintz p1, Negint p2) = p1 + p2
static member (-) (Posintz p1, Negint p2) = Posint (p1 - p2)
static member (*) (Posintz p1, Negint p2) = Negintz (p1 * p2)
static member (/) (Posintz p1, Negint p2) = Negintz (p1 / p2)
SN
// posintz & negintz
static member (+) (Posintz p1, Negintz p2) = p1 + p2
static member (-) (Posintz p1, Negintz p2) = Posintz (p1 - p2)
static member (*) (Posintz p1, Negintz p2) = Negintz (p1 * p2)
static member (/) (Posintz p1, Negintz p2) = Negintz (p1 / p2)
and
[<SuppressMessage("*", "TypeNames")>]
negint = private Negint of int
with
static member OfInt =
Constrain.constrain (fun (n : int) ->
if n < 0
then Success (Negint n)
else failf "Expected negative int, received %d" n)
// negint & int
static member (+) (Negint p1, p2 : int) = p1 + p2
static member (+) (p1 : int, Negint p2) = p1 + p2
static member (*) (Negint p1, p2 : int) = p1 * p2
static member (*) (p1 : int, Negint p2) = p1 * p2
static member (-) (Negint p1, p2 : int) = p1 - p2
static member (-) (p1 : int, Negint p2) = p1 - p2
static member (/) (Negint p1, p2 : int) = p1 / p2
static member (/) (p1 : int, Negint p2) = p1 / p2
// negint & negint
static member (+) (Negint p1, Negint p2) = Negint (p1 + p2)
static member (-) (Negint p1, Negint p2) = p1 - p2
static member (*) (Negint p1, Negint p2) = Posint (p1 * p2)
static member (/) (Negint p1, Negint p2) = Posintz (p1 / p2)
// negint & posint
static member (+) (Negint p1, Posint p2) = p1 + p2
static member (-) (Negint p1, Posint p2) = Negint (p1 - p2)
static member (*) (Negint p1, Posint p2) = Negint (p1 * p2)
static member (/) (Negint p1, Posint p2) = Negintz (p1 / p2)
// negint & posintz
static member (+) (Negint p1, Posintz p2) = p1 + p2
static member (-) (Negint p1, Posintz p2) = Negint (p1 - p2)
static member (*) (Negint p1, Posintz p2) = Negintz (p1 * p2)
static member (/) (Negint p1, Posintz p2) = Negintz (p1 / p2)
// negint & negintz
static member (+) (Negint p1, Negintz p2) = Negint (p1 + p2)
static member (-) (Negint p1, Negintz p2) = p1 - p2
static member (*) (Negint p1, Negintz p2) = Posintz (p1 * p2)
static member (/) (Negint p1, Negintz p2) = Posintz (p1 / p2)
and
[<SuppressMessage("*", "TypeNames")>]
negintz = private Negintz of int
with
static member OfInt =
Constrain.constrain (fun (n : int) ->
if n <= 0
then Success (Negintz n)
else failf "Expected non-positive int, received %d" n)
// negintz & int
static member (+) (Negintz p1, p2 : int) = p1 + p2
static member (+) (p1 : int, Negintz p2) = p1 + p2
static member (*) (Negintz p1, p2 : int) = p1 * p2
static member (*) (p1 : int, Negintz p2) = p1 * p2
static member (-) (Negintz p1, p2 : int) = p1 - p2
static member (-) (p1 : int, Negintz p2) = p1 - p2
static member (/) (Negintz p1, p2 : int) = p1 / p2
static member (/) (p1 : int, Negintz p2) = p1 / p2
// negintz & negintz
static member (+) (Negintz p1, Negintz p2) = Negintz (p1 + p2)
static member (-) (Negintz p1, Negintz p2) = p1 - p2
static member (*) (Negintz p1, Negintz p2) = Posintz (p1 * p2)
static member (/) (Negintz p1, Negintz p2) = Posintz (p1 / p2)
// negintz & posint
static member (+) (Negintz p1, Posint p2) = p1 + p2
static member (-) (Negintz p1, Posint p2) = Negint (p1 - p2)
static member (*) (Negintz p1, Posint p2) = Negintz (p1 * p2)
static member (/) (Negintz p1, Posint p2) = Negintz (p1 / p2)
// negintz & posintz
static member (+) (Negintz p1, Posintz p2) = p1 + p2
static member (-) (Negintz p1, Posintz p2) = Negintz (p1 - p2)
static member (*) (Negintz p1, Posintz p2) = Negintz (p1 * p2)
static member (/) (Negintz p1, Posintz p2) = Negintz (p1 / p2)
SN
// negintz & negint
static member (+) (Negintz p1, Negint p2) = Negint (p1 + p2)
static member (-) (Negintz p1, Negint p2) = p1 - p2
static member (*) (Negintz p1, Negint p2) = Posintz (p1 * p2)
static member (/) (Negintz p1, Negint p2) = Posintz (p1 / p2)
let posintf = posint.OfInt.Create
let posint = posint.OfInt.TryCreate
let posintzf = posintz.OfInt.Create
let posintz = posintz.OfInt.TryCreate
let negintf = negint.OfInt.Create
let negint = negint.OfInt.TryCreate
let negintzf = negintz.OfInt.Create
let negintz = negintz.OfInt.TryCreate
ak
ak
SN
SN
ak
SN
КП
VK
// negintz & negint
static member (+) (Negintz p1, Negint p2) = Negint (p1 + p2)
static member (-) (Negintz p1, Negint p2) = p1 - p2
static member (*) (Negintz p1, Negint p2) = Posintz (p1 * p2)
static member (/) (Negintz p1, Negint p2) = Posintz (p1 / p2)
let posintf = posint.OfInt.Create
let posint = posint.OfInt.TryCreate
let posintzf = posintz.OfInt.Create
let posintz = posintz.OfInt.TryCreate
let negintf = negint.OfInt.Create
let negint = negint.OfInt.TryCreate
let negintzf = negintz.OfInt.Create
let negintz = negintz.OfInt.TryCreate
DS