'How to create Discriminated Union with private constructor?

I have the following DU:

type Vector<'T when 'T: (static member (+): 'T * 'T -> 'T) and 'T: (static member (*): 'T * 'T -> 'T)> =
        private
        | Vector of ('T list)
   

I've tried creating a factory function like this (within the same module):

let inline from_list (xs: 'T list) =
        match xs.Length with
        | 0 -> failwith "Cannot create a zero-length Vector"
        | _ -> Vector.Vector xs

but it gives me compilation error:

error FS1113: The value 'from_list' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible 1>

I've also tried defining it as a "static inline member" function but result is the same.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source