Skip to content

Commit

Permalink
fixing plugin and adding scala doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrapyre committed May 21, 2024
1 parent 96133f8 commit a065e99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions core/src/main/scala/magnolia1/magnolia.scala
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,16 @@ private[magnolia1] object CompileTimeState {
}

object CallByNeed {

/** Initializes a class that allows for suspending evaluation of a value until it is needed. Evaluation of a value via `.value` can only
* happen once. Evaluation of a value via `.valueEvaluator` will return None. For evaluating a value multiple times, please construct a
* CallByNeed via CallByNeed.withValueEvaluator(value)
*/
def apply[A](a: => A): CallByNeed[A] = new CallByNeed(() => a, () => false)

/** Initializes a class that allows for suspending evaluation of a value until it is needed. Evaluation of a value via `.value` can only
* happen once. Evaluation of a value via `.valueEvaluator.map(evaluator => evaluator())` will happen every time the evaluator is called
*/
def withValueEvaluator[A](a: => A): CallByNeed[A] = new CallByNeed(() => a, () => true)
}

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" %

addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")

0 comments on commit a065e99

Please sign in to comment.