Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Function0 syntax #3185

Merged
merged 1 commit into from
Dec 3, 2019
Merged
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions core/src/main/scala/cats/Eval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ final class Later[A](f: () => A) extends Eval[A] {
}

object Later {
def apply[A](a: => A): Later[A] = new Later(a _)
def apply[A](a: => A): Later[A] = new Later(() => a)
}

/**
Expand All @@ -175,7 +175,7 @@ final class Always[A](f: () => A) extends Eval[A] {
}

object Always {
def apply[A](a: => A): Always[A] = new Always(a _)
def apply[A](a: => A): Always[A] = new Always(() => a)
}

object Eval extends EvalInstances {
Expand All @@ -188,12 +188,12 @@ object Eval extends EvalInstances {
/**
* Construct a lazy Eval[A] value with caching (i.e. Later[A]).
*/
def later[A](a: => A): Eval[A] = new Later(a _)
def later[A](a: => A): Eval[A] = new Later(() => a)

/**
* Construct a lazy Eval[A] value without caching (i.e. Always[A]).
*/
def always[A](a: => A): Eval[A] = new Always(a _)
def always[A](a: => A): Eval[A] = new Always(() => a)

/**
* Defer a computation which produces an Eval[A] value.
Expand All @@ -202,7 +202,7 @@ object Eval extends EvalInstances {
* which produces an Eval[A] value. Like .flatMap, it is stack-safe.
*/
def defer[A](a: => Eval[A]): Eval[A] =
new Eval.Defer[A](a _) {}
new Eval.Defer[A](() => a) {}

/**
* Static Eval instance for common value `Unit`.
Expand Down