Skip to content
Snippets Groups Projects
Commit 2316cb90 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Set/Map should be cases classes so that equality is consistent

parent c8997c5b
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ object Map { ...@@ -12,7 +12,7 @@ object Map {
} }
@ignore @ignore
class Map[A, B](val theMap: scala.collection.immutable.Map[A,B]) { case class Map[A, B](val theMap: scala.collection.immutable.Map[A,B]) {
def apply(k: A): B = theMap.apply(k) def apply(k: A): B = theMap.apply(k)
def ++(b: Map[A, B]): Map[A,B] = new Map (theMap ++ b.theMap) def ++(b: Map[A, B]): Map[A,B] = new Map (theMap ++ b.theMap)
def updated(k: A, v: B): Map[A,B] = new Map(theMap.updated(k, v)) def updated(k: A, v: B): Map[A,B] = new Map(theMap.updated(k, v))
......
...@@ -12,7 +12,7 @@ object Set { ...@@ -12,7 +12,7 @@ object Set {
} }
@ignore @ignore
class Set[T](val theSet: scala.collection.immutable.Set[T]) { case class Set[T](val theSet: scala.collection.immutable.Set[T]) {
def +(a: T): Set[T] = new Set[T](theSet + a) def +(a: T): Set[T] = new Set[T](theSet + a)
def ++(a: Set[T]): Set[T] = new Set[T](theSet ++ a.theSet) def ++(a: Set[T]): Set[T] = new Set[T](theSet ++ a.theSet)
def -(a: T): Set[T] = new Set[T](theSet - a) def -(a: T): Set[T] = new Set[T](theSet - a)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment