Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f81c8ed
Make Id covariant
travisbrown Jan 21, 2020
1971593
Re-encode relationships to avoid implicit conversion functions
travisbrown Feb 26, 2020
8365cb5
Use ArraySeq.untagged instead of ClassTag[Nothing]
travisbrown Feb 26, 2020
3614cec
Set up Scalafix
travisbrown Dec 1, 2019
f9e0fec
Exclude extra methods from Simulacrum syntax generation
travisbrown Dec 1, 2019
fd1870d
Run Simulacrum Scalafix rules and format
travisbrown Jan 12, 2020
c5d3f13
Set up Dotty
travisbrown Dec 4, 2019
a2a25bc
Skip cats-free on Dotty for now
travisbrown Jan 24, 2020
d8e73d7
Move FunctionK macro into Scala 2-specific directory
travisbrown Dec 4, 2019
a1b30ef
Replace kind-projector's polymorphic lambda syntax
travisbrown Feb 26, 2020
6b40c3a
Some cats-laws Dotty fixes
travisbrown Jan 12, 2020
d7cc277
Avoid == with different types for Dotty
travisbrown Jan 20, 2020
8189049
Parentheses for Dotty
travisbrown Jan 20, 2020
0da41a4
Work around ScalaTest assert macro issue on Dotty
travisbrown Jan 20, 2020
9c6bc18
Don't test FunctionK.lift for Dotty
travisbrown Jan 20, 2020
468bcb9
Avoid collision with tuple map on Dotty
travisbrown Jan 20, 2020
3d304a3
Work around Dotty #7993: avoid type alias with enrichment method
travisbrown Jan 20, 2020
a6de224
Work around Dotty #7999: annotate type to avoid ambiguous implicit
travisbrown Jan 20, 2020
f430427
Work around Dotty #7999 (I think): annotate type
travisbrown Jan 20, 2020
f62ee06
Work around Dotty #8001: can't instantiate type class trait for value…
travisbrown Jan 20, 2020
97031b0
Work around Dotty #8033: don't test serialization for mixed-in instance
travisbrown Jan 20, 2020
ebd0055
Work around Dotty #8048: add Id instance imports
travisbrown Jan 20, 2020
fb4355b
Remove tests involving newtype encoding issue on Dotty (see Cats #3117)
travisbrown Jan 20, 2020
d4ddad2
Add some types Dotty can't infer for some reason
travisbrown Jan 20, 2020
3630274
Don't test parSequence_ syntax Dotty can't compile
travisbrown Jan 20, 2020
e14dce7
Work around syntax issue with local Bitraverse instance on Dotty
travisbrown Jan 20, 2020
0158a9c
Don't test Parallel.apply stuff Dotty doesn't like
travisbrown Jan 20, 2020
b01c325
Add Dotty to CI
travisbrown Jan 24, 2020
0bc221e
Update Dotty nightly
travisbrown Feb 3, 2020
073bb81
Revert "Make Id covariant"
travisbrown Feb 25, 2020
ebb56ac
Update Dotty and Dotty dependencies
travisbrown Feb 26, 2020
593c05d
Disable fatal warnings on Dotty because of #8383
travisbrown Feb 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TAGS
*.sublime-project
*.sublime-workspace
tests.iml
.semanticdb
# Auto-copied by sbt-microsites
docs/src/main/tut/contributing.md
docs/src/main/tut/index.md
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jdk:

scala_version_212: &scala_version_212 2.12.10
scala_version_213: &scala_version_213 2.13.1
scala_version_dotty: &scala_version_dotty 0.22.0-RC1

before_install:
- export PATH=${PATH}:./vendor/bundle
Expand Down Expand Up @@ -50,6 +51,11 @@ jobs:
scala: *scala_version_213
after_success: codecov -F scala_version_213

- &jvm_dotty_tests
stage: test
env: TEST="JVM Dotty tests"
script: sbt ++$TRAVIS_SCALA_VERSION! buildJVMDottyCompat
scala: *scala_version_dotty

- stage: test
env: TEST="docs"
Expand Down
38 changes: 37 additions & 1 deletion alleycats-core/src/main/scala/alleycats/ConsK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package alleycats

import cats.SemigroupK
import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait ConsK[F[_]] {
@implicitNotFound("Could not find an instance of ConsK for ${F}")
@typeclass trait ConsK[F[_]] extends Serializable {
def cons[A](hd: A, tl: F[A]): F[A]
}

Expand All @@ -12,4 +14,38 @@ object ConsK {
new ConsK[F] {
def cons[A](hd: A, tl: F[A]): F[A] = s.combineK(p.pure(hd), tl)
}

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[ConsK]] for `F`.
*/
@inline def apply[F[_]](implicit instance: ConsK[F]): ConsK[F] = instance

trait Ops[F[_], A] {
type TypeClassType <: ConsK[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToConsKOps {
implicit def toConsKOps[F[_], A](target: F[A])(implicit tc: ConsK[F]): Ops[F, A] {
type TypeClassType = ConsK[F]
} = new Ops[F, A] {
type TypeClassType = ConsK[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToConsKOps
object ops {
implicit def toAllConsKOps[F[_], A](target: F[A])(implicit tc: ConsK[F]): AllOps[F, A] {
type TypeClassType = ConsK[F]
} = new AllOps[F, A] {
type TypeClassType = ConsK[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
}
40 changes: 39 additions & 1 deletion alleycats-core/src/main/scala/alleycats/Empty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import cats.{Eq, Monoid}
import cats.syntax.eq._

import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait Empty[A] {
@implicitNotFound("Could not find an instance of Empty for ${A}")
@typeclass trait Empty[A] extends Serializable {
def empty: A

def isEmpty(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -20,6 +22,42 @@ object Empty extends EmptyInstances0 {
new Empty[A] { lazy val empty: A = a }

def fromEmptyK[F[_], T](implicit ekf: EmptyK[F]): Empty[F[T]] = ekf.synthesize[T]

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[Empty]] for `A`.
*/
@inline def apply[A](implicit instance: Empty[A]): Empty[A] = instance

trait Ops[A] {
type TypeClassType <: Empty[A]
def self: A
val typeClassInstance: TypeClassType
def isEmpty(implicit ev: Eq[A]): Boolean = typeClassInstance.isEmpty(self)(ev)
def nonEmpty(implicit ev: Eq[A]): Boolean = typeClassInstance.nonEmpty(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToEmptyOps {
implicit def toEmptyOps[A](target: A)(implicit tc: Empty[A]): Ops[A] {
type TypeClassType = Empty[A]
} = new Ops[A] {
type TypeClassType = Empty[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToEmptyOps
object ops {
implicit def toAllEmptyOps[A](target: A)(implicit tc: Empty[A]): AllOps[A] {
type TypeClassType = Empty[A]
} = new AllOps[A] {
type TypeClassType = Empty[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
}

private[alleycats] trait EmptyInstances0 extends compat.IterableEmptyInstance with EmptyInstances1
Expand Down
41 changes: 40 additions & 1 deletion alleycats-core/src/main/scala/alleycats/EmptyK.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,51 @@
package alleycats

import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait EmptyK[F[_]] { self =>
@implicitNotFound("Could not find an instance of EmptyK for ${F}")
@typeclass trait EmptyK[F[_]] extends Serializable { self =>
def empty[A]: F[A]

def synthesize[A]: Empty[F[A]] =
new Empty[F[A]] {
def empty: F[A] = self.empty[A]
}
}

object EmptyK {

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[EmptyK]] for `F`.
*/
@inline def apply[F[_]](implicit instance: EmptyK[F]): EmptyK[F] = instance

trait Ops[F[_], A] {
type TypeClassType <: EmptyK[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToEmptyKOps {
implicit def toEmptyKOps[F[_], A](target: F[A])(implicit tc: EmptyK[F]): Ops[F, A] {
type TypeClassType = EmptyK[F]
} = new Ops[F, A] {
type TypeClassType = EmptyK[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToEmptyKOps
object ops {
implicit def toAllEmptyKOps[F[_], A](target: F[A])(implicit tc: EmptyK[F]): AllOps[F, A] {
type TypeClassType = EmptyK[F]
} = new AllOps[F, A] {
type TypeClassType = EmptyK[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
}
39 changes: 38 additions & 1 deletion alleycats-core/src/main/scala/alleycats/Extract.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package alleycats
import cats.{CoflatMap, Comonad}

import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait Extract[F[_]] {
@implicitNotFound("Could not find an instance of Extract for ${F}")
@typeclass trait Extract[F[_]] extends Serializable {
def extract[A](fa: F[A]): A
}

Expand All @@ -22,4 +24,39 @@ object Extract {
override def map[A, B](fa: F[A])(f: A => B): F[B] = cf.map(fa)(f)
def coflatMap[A, B](fa: F[A])(f: F[A] => B): F[B] = cf.coflatMap(fa)(f)
}

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[Extract]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Extract[F]): Extract[F] = instance

trait Ops[F[_], A] {
type TypeClassType <: Extract[F]
def self: F[A]
val typeClassInstance: TypeClassType
def extract: A = typeClassInstance.extract[A](self)
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToExtractOps {
implicit def toExtractOps[F[_], A](target: F[A])(implicit tc: Extract[F]): Ops[F, A] {
type TypeClassType = Extract[F]
} = new Ops[F, A] {
type TypeClassType = Extract[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToExtractOps
object ops {
implicit def toAllExtractOps[F[_], A](target: F[A])(implicit tc: Extract[F]): AllOps[F, A] {
type TypeClassType = Extract[F]
} = new AllOps[F, A] {
type TypeClassType = Extract[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
}
40 changes: 39 additions & 1 deletion alleycats-core/src/main/scala/alleycats/One.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package alleycats
import cats.Eq
import cats.syntax.eq._
import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait One[A] {
@implicitNotFound("Could not find an instance of One for ${A}")
@typeclass trait One[A] extends Serializable {
def one: A

def isOne(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -17,4 +19,40 @@ import simulacrum.typeclass
object One {
def apply[A](a: => A): One[A] =
new One[A] { lazy val one: A = a }

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[One]] for `A`.
*/
@inline def apply[A](implicit instance: One[A]): One[A] = instance

trait Ops[A] {
type TypeClassType <: One[A]
def self: A
val typeClassInstance: TypeClassType
def isOne(implicit ev: Eq[A]): Boolean = typeClassInstance.isOne(self)(ev)
def nonOne(implicit ev: Eq[A]): Boolean = typeClassInstance.nonOne(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToOneOps {
implicit def toOneOps[A](target: A)(implicit tc: One[A]): Ops[A] {
type TypeClassType = One[A]
} = new Ops[A] {
type TypeClassType = One[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToOneOps
object ops {
implicit def toAllOneOps[A](target: A)(implicit tc: One[A]): AllOps[A] {
type TypeClassType = One[A]
} = new AllOps[A] {
type TypeClassType = One[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
}
38 changes: 37 additions & 1 deletion alleycats-core/src/main/scala/alleycats/Pure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package alleycats

import cats.{Applicative, FlatMap, Monad}
import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait Pure[F[_]] {
@implicitNotFound("Could not find an instance of Pure for ${F}")
@typeclass trait Pure[F[_]] extends Serializable {
def pure[A](a: A): F[A]
}

Expand All @@ -22,4 +24,38 @@ object Pure {
def flatMap[A, B](fa: F[A])(f: A => F[B]): F[B] = fm.flatMap(fa)(f)
def tailRecM[A, B](a: A)(f: (A) => F[Either[A, B]]): F[B] = fm.tailRecM(a)(f)
}

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[Pure]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Pure[F]): Pure[F] = instance

trait Ops[F[_], A] {
type TypeClassType <: Pure[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToPureOps {
implicit def toPureOps[F[_], A](target: F[A])(implicit tc: Pure[F]): Ops[F, A] {
type TypeClassType = Pure[F]
} = new Ops[F, A] {
type TypeClassType = Pure[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToPureOps
object ops {
implicit def toAllPureOps[F[_], A](target: F[A])(implicit tc: Pure[F]): AllOps[F, A] {
type TypeClassType = Pure[F]
} = new AllOps[F, A] {
type TypeClassType = Pure[F]
val self: F[A] = target
val typeClassInstance: TypeClassType = tc
}
}
}
40 changes: 39 additions & 1 deletion alleycats-core/src/main/scala/alleycats/Zero.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import cats.Eq
import cats.syntax.eq._

import simulacrum.typeclass
import scala.annotation.implicitNotFound

@typeclass trait Zero[A] {
@implicitNotFound("Could not find an instance of Zero for ${A}")
@typeclass trait Zero[A] extends Serializable {
def zero: A

def isZero(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -18,4 +20,40 @@ import simulacrum.typeclass
object Zero {
def apply[A](a: => A): Zero[A] =
new Zero[A] { lazy val zero: A = a }

/****************************************************************************
* THE REST OF THIS OBJECT IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! *
****************************************************************************/
/**
* Summon an instance of [[Zero]] for `A`.
*/
@inline def apply[A](implicit instance: Zero[A]): Zero[A] = instance

trait Ops[A] {
type TypeClassType <: Zero[A]
def self: A
val typeClassInstance: TypeClassType
def isZero(implicit ev: Eq[A]): Boolean = typeClassInstance.isZero(self)(ev)
def nonZero(implicit ev: Eq[A]): Boolean = typeClassInstance.nonZero(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToZeroOps {
implicit def toZeroOps[A](target: A)(implicit tc: Zero[A]): Ops[A] {
type TypeClassType = Zero[A]
} = new Ops[A] {
type TypeClassType = Zero[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
object nonInheritedOps extends ToZeroOps
object ops {
implicit def toAllZeroOps[A](target: A)(implicit tc: Zero[A]): AllOps[A] {
type TypeClassType = Zero[A]
} = new AllOps[A] {
type TypeClassType = Zero[A]
val self: A = target
val typeClassInstance: TypeClassType = tc
}
}
}
Loading