LazyConversions

org.specs2.control.LazyConversions
See theLazyConversions companion object

These functions can be used to allow some function to be called with varargs, with values being evaluated lazily:

 def method[T](values: Lazy[T]*) = {
   values.to(LazyList) // use the toStream method to consume the values lazily
 }
 // usage
 method(exp1, exp2, exp3)

Note that the values are really evaluated once, unlike a by-name parameter.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object LazyConversions.type

Members list

Concise view

Implicits

Implicits

implicit def lazyParameter[T](value: => T)(using CanEqual[T, T]): Lazy[T]

transform a value to a zero-arg function returning that value

transform a value to a zero-arg function returning that value

Attributes