F# generic add function

I’m working on a project which requires us to have a “standard library” across various languages/platforms. Portions of this “standard library” map very close to the elm/core library for the Elm platform/language.

One function I need to define is add. In Elm they have a numeric “type class”, but F# doesn’t support this. How can I define a generic add function in my module that works for different numeric types? The code-snippet below shows the issue. For all functions below I was able to map the equivalent Elm functions to F# and F# infers the types properly. The add function however always warns, with this message:

FS0064: This construct causes code to be less generic than indicated by the type annotations.

How can I fix this (Please note I will be applying this solution to define subtract, multiply, etc)

[<AutoOpen>]
    module Morphir.SDK.Basics

    let (<|) =  Microsoft.FSharp.Core.Operators.(<|)
    let (|>) = Microsoft.FSharp.Core.Operators.(|>)

    let add (a:^a) (b:^b) :^c = (+) a b

    let inline abs (n:^a) =
        Microsoft.FSharp.Core.Operators.abs(n)

    let inline pow (x:^a) (n:int) =
        Microsoft.FSharp.Core.Operators.pown x n

So this seems to work:

let inline add (value1 : ^T when ^T : (static member (+) : ^T * ^T -> ^T)) (value2: ^T) =
    value1 + value2

I suppose you can use simple inline here as well:

let inline add a b = (+) a b