mpilquist on master
Updated README for 0.15 release (compare)
mpilquist on v0.15.0
mpilquist on master
Setting version to 0.15.0 Setting version to 0.15.1-SNAPS… (compare)
mpilquist on master
Update scalatest to 3.0.6-SNAP6 Merge pull request #125 from sc… (compare)
mpilquist on master
Update sbt-release to 1.0.11 Merge pull request #123 from sc… (compare)
mpilquist on master
Add support for DocDef Add support for DocDef - test Disabled ScalaDoc generation on… and 2 more (compare)
mpilquist on master
Future proof subtype evidence … Merge pull request #126 from jo… (compare)
A <: Direction
I mean.
A
are provided: Does not compile: value truthy is not a member of object North, South, East or West
:import simulacrum._
// True north is the only truthy direction
sealed trait Direction
object North extends Direction
object South extends Direction
object East extends Direction
object West extends Direction
trait TruthyImplicits3 {
@typeclass trait Truthy[A] { self =>
/** @return true if `direction` is truthy. */
@op("truthy") def truthy(direction: A): Boolean
}
implicit val directionCanTruthy: Truthy[Direction] = {
case North => true
case _ => false
}
}
object CanTruthy3 extends App with TruthyImplicits3 {
import Truthy.ops._
println(s"North.truthy = ${ North.truthy }")
println(s"South.truthy = ${ South.truthy }")
println(s"East.truthy = ${ East.truthy }")
println(s"West.truthy = ${ West.truthy }")
}
@op
North
on the other hand has a type of North
rather than Direction
. It's a subtype of Direction
but not of type Direction
.
Direction
)
ops
imported and the implicit for Directioin
in scope.
def printTruthy[A : Truthy : Show](a: A): Unit = println(s"${a.show}.truthy = ${a.truthy}")
. Note that you don't code on a concrete type, your A
here only has two operations Show
and Truthy
. The Show
is from cats and is a typeclass with the method def show(a: A): String
.
CanTruthy3
. Questions and comments are embedded. Looking forward to responses from anyone so inclined.
@op
methods without putting a red marking on it: https://github.com/JetBrains/intellij-scala/blob/f55df32c25093dce4621f20488b825a3fa9c93d6/scala/scala-impl/src/org/jetbrains/plugins/scala/lang/psi/impl/toplevel/typedef/simulacrum/SimulacrumInjector.scala
typeclass annotation should have been removed by simulacrum but was not
. I'm on Scala 2.12.8. I ensured simulacrum dependency and compiler plugin was added as per readme instructions.
def foldA[G[_], A](fga: F[G[A]])(implicit G: Applicative[G], A: Monoid[A]): G[A]
for Foldable
and it's compiled to def foldA[G[_], A](implicit ev$macro$49: <:<[D, G[A]], G: Applicative[G], A: Monoid[D]) = typeClassInstance.foldA(self.asInstanceOf[F[G[A]]])(G, A);
which fails. Is it a bug or am I doing something wrong?
typeclass annotation should have been removed by simulacrum but was not
. I can't understand why, I'm using scala 2.13, sbt 1.3.8, simulacrum 1.0.0 and I'm copy-pasting the example in the github readme
"-Ymacro-annotations"
in my compiler options