Type level number arithmetic
问题 I'm playing around with F#'s type inferrer. Trying to get type level natural number working. Here's the part that I managed to get working type Zero = Zero type Succ<'a> = None type True = True type False = False type IsZero = | IsZero static member instance (IsZero, _ : Succ<'a>, _) = fun () -> False static member instance (IsZero, _ : Zero, _) = fun () -> True module TypeArithmetic = let inline zero x = (Inline.instance (IsZero, x) : unit -> 'a)() let dec (_ : Succ<'a>) = Unchecked