View difference between Paste ID: KdSmYg94 and yBGK4rct
SHOW: | | - or go back to the newest paste.
1
open Microsoft.FSharp.Reflection
2
3
let makeUnionCase<'T>(name: string) =
4
    let uci =
5-
        FSharpType.GetUnionCases(typeof<option<string>>)
5+
        FSharpType.GetUnionCases(typeof<'T>)
6
        |> Array.find (fun uci -> uci.Name = name)
7
    FSharpValue.MakeUnion(uci, [||]) :?> 'T