Created
April 16, 2015 12:48
-
-
Save codesurf42/e63ff31753f76c69984c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// case class Rel3(id: Int, vals: Option[Map[String, Set[Int]]]) | |
val setm1 = Map(1 -> Some(Map("a" -> Set(1,2)))) | |
val setm2 = Map(1 -> Some(Map("a" -> Set(2,3)))) | |
val setm3 = Map(1 -> None) | |
val setm4 = Map(2 -> Some(Map("b" -> Set(5,6)))) | |
val all = Set(setm1, setm2, setm3, setm4) | |
import scalaz._ | |
import Scalaz._ | |
all.reduce(_ |+| _) | |
// res0: scala.collection.immutable.Map[Int,Option[scala.collection.immutable.Map[String,scala.collection.immutable.Set[Int]]]] = Map(2 -> Some(Map(b -> Set(5, 6))), 1 -> Some(Map(a -> Set(1, 2, 3)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment