Skip to content

Commit

Permalink
Move LowPriorityImplicits to a com.softwaremill.quicklens to avoid co…
Browse files Browse the repository at this point in the history
…nflicts with other softwaremill libraries
  • Loading branch information
KacperFKorban committed Aug 13, 2024
1 parent d4c24ca commit 6e814b7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.softwaremill.quicklens

import scala.annotation.compileTimeOnly

private[quicklens] trait LowPriorityImplicits {

/**
* `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
*/
implicit class QuicklensEach[F[_], T](t: F[T])(implicit f: QuicklensFunctor[F, T]) {
@compileTimeOnly(canOnlyBeUsedInsideModify("each"))
def each: T = sys.error("")

@compileTimeOnly(canOnlyBeUsedInsideModify("eachWhere"))
def eachWhere(p: T => Boolean): T = sys.error("")
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.softwaremill

import com.softwaremill.quicklens.{QuicklensMapAtFunctor, canOnlyBeUsedInsideModify}

import scala.annotation.compileTimeOnly
import scala.collection.Factory
import scala.collection.SeqLike
Expand Down Expand Up @@ -294,18 +292,3 @@ package object quicklens extends LowPriorityImplicits {
override def eachRight(e: Either[L, R])(f: (R) => R) = e.map(f)
}
}

sealed trait LowPriorityImplicits {

import quicklens._

/** `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
*/
implicit class QuicklensEach[F[_], T](t: F[T])(implicit f: QuicklensFunctor[F, T]) {
@compileTimeOnly(canOnlyBeUsedInsideModify("each"))
def each: T = sys.error("")

@compileTimeOnly(canOnlyBeUsedInsideModify("eachWhere"))
def eachWhere(p: T => Boolean): T = sys.error("")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.softwaremill.quicklens

import scala.annotation.compileTimeOnly

private[quicklens] trait LowPriorityImplicits {

/** `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
*/
implicit class QuicklensEach[F[_], T](t: F[T])(implicit f: QuicklensFunctor[F, T]) {
@compileTimeOnly(canOnlyBeUsedInsideModify("each"))
def each: T = sys.error("")

@compileTimeOnly(canOnlyBeUsedInsideModify("eachWhere"))
def eachWhere(p: T => Boolean): T = sys.error("")
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.softwaremill

import com.softwaremill.quicklens.{QuicklensMapAtFunctor, canOnlyBeUsedInsideModify}

import scala.annotation.compileTimeOnly
import scala.collection.TraversableLike
import scala.collection.SeqLike
Expand Down Expand Up @@ -299,18 +297,3 @@ package object quicklens extends LowPriorityImplicits {
override def eachRight(e: Either[L, R])(f: (R) => R) = e.right.map(f)
}
}

sealed trait LowPriorityImplicits {

import quicklens._

/** `QuicklensEach` is in `LowPriorityImplicits` to not conflict with the `QuicklensMapAtFunctor` on `each` calls.
*/
implicit class QuicklensEach[F[_], T](t: F[T])(implicit f: QuicklensFunctor[F, T]) {
@compileTimeOnly(canOnlyBeUsedInsideModify("each"))
def each: T = sys.error("")

@compileTimeOnly(canOnlyBeUsedInsideModify("eachWhere"))
def eachWhere(p: T => Boolean): T = sys.error("")
}
}

0 comments on commit 6e814b7

Please sign in to comment.