Skip to content

Instantly share code, notes, and snippets.

@hmemcpy
Last active September 28, 2015 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmemcpy/8e126d7a3b8d25a8755d to your computer and use it in GitHub Desktop.
Save hmemcpy/8e126d7a3b8d25a8755d to your computer and use it in GitHub Desktop.
let unionCases<'a> =
FSharpType.GetUnionCases(typeof<'a>)
|> Array.map (fun x -> FSharpValue.MakeUnion(x, [||]) :?> 'a)
|> Array.toList
let deck : Deck =
(unionCases<Suit>, unionCases<Rank>) ||> cartesianProduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment