camlspotter's answer was close enough, but in your case you want to use Variantslib and add with variants
at the end of your type definition:
type foo = Foo of int | Bar of int with variants;;
gives you the following:
type foo = Foo of int | Bar of int
val bar : int -> foo = <fun>
val foo : int -> foo = <fun>
module Variants :
sig
val bar : (int -> foo) Variantslib.Variant.t
val foo : (int -> foo) Variantslib.Variant.t
end