Skip to content

Instantly share code, notes, and snippets.

View chenharryhua's full-sized avatar

Harry Chen chenharryhua

  • Tabcorp
  • Melbourne Australia
View GitHub Profile
@aishfenton
aishfenton / UnionType.scala
Last active December 10, 2019 22:15
Union Types for Scala
package union
/**
* Much magic. Very Lambda. Wow!
*
* These types provide union types (i.e. val a = (String or Int) within Scala. See here for good discussion on
* how to represent union types in Scala (hat tip Miles Sabin)
* http://stackoverflow.com/a/37450446/1591351
*
* Core idea is to adapt Demorgan's Law: