expr
Aggregator object providing convenient imports for working with Expressions.
Usage:
import expr._
val result = ∅ + 1 + 2 * 3
val expr = math"x^2 + 3x - 5"
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
expr.type
Members list
Grouped members
aliases
Allows destructuring tuples with the same syntax as constructing them.
Allows destructuring tuples with the same syntax as constructing them.
Attributes
- Example
-
val tup = "foobar" -> 3 val c = tup match { case str -> i => str.charAt(i) }
Attributes
Attributes
conversions-array-to-wrapped-array
Type parameters
- T
-
the element type of the array
Value parameters
- xs
-
the array to wrap as an
ArraySeq
Attributes
Type parameters
- T
-
the element type of the array, must be a reference type
Value parameters
- xs
-
the array of reference-typed elements to wrap as an
ArraySeq
Attributes
implicit-classes-any
Type parameters
- A
-
the type of the left-hand side of the arrow association
Value parameters
- self
-
the value to use as the first element of the resulting tuple
Attributes
Type parameters
- A
-
the type of the value being checked with
ensuring
Value parameters
- self
-
the value to check postconditions against
Attributes
Type parameters
- A
-
the type of the value to be formatted as a string
Value parameters
- self
-
the value to format
Attributes
utilities
??? can be used for marking methods that remain to be implemented.
??? can be used for marking methods that remain to be implemented.
Attributes
- Throws
-
NotImplementedError
when
???is invoked.
Retrieves the runtime representation of a class type. classOf[T] is equivalent to the class literal T.class in Java.
Retrieves the runtime representation of a class type. classOf[T] is equivalent to the class literal T.class in Java.
Type parameters
- T
-
the type whose runtime class representation is returned
Attributes
- Returns
-
The runtime Class representation of type
T. - Example
-
val listClass = classOf[List[?]] // listClass is java.lang.Class[List[?]] = class scala.collection.immutable.List val mapIntString = classOf[Map[Int,String]] // mapIntString is java.lang.Class[Map[Int,String]] = interface scala.collection.immutable.Map
A method that returns its input value.
A method that returns its input value.
Type parameters
- A
-
the type of the input value
x
Value parameters
- x
-
the value of type
Ato be returned
Attributes
- Returns
-
the value
x
Summon an implicit value of type T. Usually, the argument is not passed explicitly.
Summon an implicit value of type T. Usually, the argument is not passed explicitly.
Type parameters
- T
-
the type of the value to be summoned
Value parameters
- e
-
the implicit value of type
T
Attributes
- Returns
-
the implicit value of type
T
Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like. This is just a different name for identity.
Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like. This is just a different name for identity.
Type parameters
- T
-
the type of the expression being guarded
Attributes
- Example
-
Separating code blocks from
new:val x = new AnyRef { val y = ... println(y) } // the { ... } block is seen as the body of an anonymous class val x = new AnyRef { val y = ... println(y) } // an empty line is a brittle "fix" val x = new AnyRef locally { val y = ... println(y) } // locally guards the block and helps communicate intent
Retrieves the single value of a type with a unique inhabitant.
Retrieves the single value of a type with a unique inhabitant.
Type parameters
- T
-
the singleton type whose unique value is retrieved
Attributes
- Returns
-
the unique inhabitant of type
T - Example
-
object Foo val foo = valueOf[Foo.type] // foo is Foo.type = Foo val bar = valueOf[23] // bar is 23.type = 23
Retrieves the single value of a type with a unique inhabitant.
Retrieves the single value of a type with a unique inhabitant.
Type parameters
- T
-
the singleton type whose unique value is retrieved
Value parameters
- vt
-
the implicit
ValueOfinstance that provides the value
Attributes
- Returns
-
the unique inhabitant of type
T - Example
-
object Foo val foo = valueOf[Foo.type] // foo is Foo.type = Foo val bar = valueOf[23] // bar is 23.type = 23
Extensions
Extensions
Exports
Defined exports
An implicit of type A => A is available for all A because it can always be implemented using the identity function. This also means that an implicit of type A => B is always available when A A) B).
An implicit of type A => A is available for all A because it can always be implemented using the identity function. This also means that an implicit of type A => B is always available when A A) B).
Attributes
Summon a given value of type T. Usually, the argument is not passed explicitly.
Summon a given value of type T. Usually, the argument is not passed explicitly.
Type parameters
- T
-
the type of the value to be summoned
Value parameters
- x
-
the given value of type
T
Attributes
- Returns
-
the given value with its singleton type preserved
Deprecated defined exports
Attributes
- Deprecated
-
[Since version 2.13.0]implicit conversions from Array to immutable.IndexedSeq are implemented by copying; use `toIndexedSeq` explicitly if you want to copy, or use the more efficient non-copying ArraySeq.unsafeWrapArray
Experimental defined exports
Attributes
- Experimental
- true