Advertisement
Guest User

Untitled

a guest
Aug 5th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open Microsoft.FSharp.Reflection
  2.  
  3. let makeUnionCase<'T>(name: string) =
  4.    let uci =
  5.        FSharpType.GetUnionCases(typeof<'T>)
  6.         |> Array.find (fun uci -> uci.Name = name)
  7.     FSharpValue.MakeUnion(uci, [||]) :?> 'T
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement