Skip to content

Commit 7afc89f

Browse files
author
Luka Jacobowitz
committed
Hide more newtype machinery
1 parent d3d1635 commit 7afc89f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

core/src/main/scala/cats/data/NonEmptyMapImpl.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ import cats.{Always, Apply, Eval, Foldable, Functor, Later, NonEmptyTraverse, No
2323

2424
import scala.collection.immutable._
2525

26-
private[data] trait Newtype2 { self =>
27-
type Base
28-
trait Tag extends Any
29-
type Type[A, +B] <: Base with Tag
26+
trait Newtype2 { self =>
27+
private type Base
28+
private trait Tag extends Any
29+
private[cats] type Type[A, +B] <: Base with Tag
3030
}
3131

3232

33-
object NonEmptyMapImpl extends NonEmptyMapInstances with Newtype2 {
33+
private[data] object NonEmptyMapImpl extends NonEmptyMapInstances with Newtype2 {
3434

3535
private[cats] def create[K, A](m: SortedMap[K, A]): Type[K, A] =
3636
m.asInstanceOf[Type[K, A]]

laws/src/main/scala/cats/laws/discipline/Arbitrary.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ object arbitrary extends ArbitraryInstances0 {
8080
a <- A.arbitrary
8181
} yield NonEmptyMap((k, a), fa))
8282

83-
implicit def cogenNonEmptyMap[K: Order : Cogen, A: Order : Cogen]: Cogen[NonEmptyMap.Type[K, A]] =
83+
implicit def cogenNonEmptyMap[K: Order : Cogen, A: Order : Cogen]: Cogen[NonEmptyMap[K, A]] =
8484
Cogen[SortedMap[K, A]].contramap(_.toSortedMap)
8585

8686
implicit def catsLawsArbitraryForEitherT[F[_], A, B](implicit F: Arbitrary[F[Either[A, B]]]): Arbitrary[EitherT[F, A, B]] =

tests/src/test/scala/cats/tests/NonEmptyMapSuite.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class NonEmptyMapSuite extends CatsSuite {
4242
}
4343

4444
test("Show is formatted correctly") {
45-
val nonEmptyMap = NonEmptyMapImpl("Key" -> "Test", SortedMap.empty[String, String])
45+
val nonEmptyMap = NonEmptyMap.one("Key", "Test")
4646
nonEmptyMap.show should ===("NonEmptySortedMap(Key -> Test)")
4747
}
4848

@@ -169,23 +169,23 @@ class NonEmptyMapSuite extends CatsSuite {
169169

170170
test("fromMap round trip") {
171171
forAll { l: SortedMap[String, Int] =>
172-
NonEmptyMapImpl.fromMap(l).map(_.toSortedMap).getOrElse(SortedMap.empty[String, Int]) should ===(l)
172+
NonEmptyMap.fromMap(l).map(_.toSortedMap).getOrElse(SortedMap.empty[String, Int]) should ===(l)
173173
}
174174

175175
forAll { nem: NonEmptyMap[String, Int] =>
176-
NonEmptyMapImpl.fromMap(nem.toSortedMap) should ===(Some(nem))
176+
NonEmptyMap.fromMap(nem.toSortedMap) should ===(Some(nem))
177177
}
178178
}
179179

180180
test("fromMapUnsafe/fromMap consistency") {
181181
forAll { nem: NonEmptyMap[String, Int] =>
182-
NonEmptyMapImpl.fromMap(nem.toSortedMap) should ===(Some(NonEmptyMapImpl.fromMapUnsafe(nem.toSortedMap)))
182+
NonEmptyMap.fromMap(nem.toSortedMap) should ===(Some(NonEmptyMap.fromMapUnsafe(nem.toSortedMap)))
183183
}
184184
}
185185

186186
test("fromMapUnsafe empty map") {
187187
val _ = intercept[IllegalArgumentException] {
188-
NonEmptyMapImpl.fromMapUnsafe(SortedMap.empty[String, Int])
188+
NonEmptyMap.fromMapUnsafe(SortedMap.empty[String, Int])
189189
}
190190
}
191191

0 commit comments

Comments
 (0)