forked from typelevel/cats
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run Simulacrum Scalafix rules and format
- Loading branch information
1 parent
69d91a0
commit a891d38
Showing
50 changed files
with
2,461 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,56 @@ | ||
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 FOLLOWING CODE 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 | ||
} | ||
} | ||
|
||
/****************************************************************************/ | ||
/* END OF SIMULACRUM-MANAGED CODE */ | ||
/****************************************************************************/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.