From 86d394a51b1d0a1dc970b642774c1371b07267fc Mon Sep 17 00:00:00 2001 From: Luka Jacobowitz Date: Wed, 7 Feb 2018 13:00:05 +0100 Subject: [PATCH] Move newtype to its own file --- core/src/main/scala/cats/data/Newtype.scala | 8 ++++++++ core/src/main/scala/cats/data/NonEmptySet.scala | 7 +------ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 core/src/main/scala/cats/data/Newtype.scala diff --git a/core/src/main/scala/cats/data/Newtype.scala b/core/src/main/scala/cats/data/Newtype.scala new file mode 100644 index 00000000000..6970c874947 --- /dev/null +++ b/core/src/main/scala/cats/data/Newtype.scala @@ -0,0 +1,8 @@ +package cats +package data + +trait Newtype { self => + private[data] type Base + private[data] trait Tag extends Any + private[cats] type Type[A] <: Base with Tag +} diff --git a/core/src/main/scala/cats/data/NonEmptySet.scala b/core/src/main/scala/cats/data/NonEmptySet.scala index 2f12179d6b2..6a8792c0993 100644 --- a/core/src/main/scala/cats/data/NonEmptySet.scala +++ b/core/src/main/scala/cats/data/NonEmptySet.scala @@ -23,11 +23,6 @@ import cats.{Always, Eq, Eval, Foldable, Later, Now, Reducible, SemigroupK, Show import scala.collection.immutable._ -trait Newtype { self => - private[data] type Base - private[data] trait Tag extends Any - private[cats] type Type[A] <: Base with Tag -} private[data] object NonEmptySetImpl extends NonEmptySetInstances with Newtype { @@ -56,7 +51,7 @@ private[data] object NonEmptySetImpl extends NonEmptySetInstances with Newtype { } -private[data] sealed class NonEmptySetOps[A](val value: NonEmptySetImpl.Type[A]) { +sealed class NonEmptySetOps[A](val value: NonEmptySet[A]) { private implicit val ordering: Ordering[A] = toSortedSet.ordering private implicit val order: Order[A] = Order.fromOrdering