Skip to content

Instantly share code, notes, and snippets.

@hmemcpy
Last active September 28, 2015 19:01
Show Gist options
  • Select an option

  • Save hmemcpy/8e126d7a3b8d25a8755d to your computer and use it in GitHub Desktop.

Select an option

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