choose
is a function from Sets to Options with no type specific cases
choose
is a function from Sets to Options with no type specific cases
object choose extends (Set ~> Option) { def apply[T](s : Set[T]) = s.headOption }
They are nevertheless interoperable with ordinary monomorphic function values.
They are nevertheless interoperable with ordinary monomorphic function values.
choose
is convertible to an ordinary monomorphic function value and can be
mapped across an ordinary Scala List
Being polymorphic, they may be passed as arguments to functions or methods and then applied to values of different types within those functions,
Being polymorphic, they may be passed as arguments to functions or methods and then applied to values of different types within those functions,
scala> def pairApply(f: Set ~> Option) = (f(Set(1, 2, 3)), f(Set('a', 'b', 'c'))) pairApply: (f: shapeless.poly.~>[Set,Option])(Option[Int], Option[Char]) scala> pairApply(choose) res2: (Option[Int], Option[Char]) = (Some(1),Some(a))
However, they are more general than natural transformations and are able to capture type-specific cases
which, as we'll see below, makes them ideal for generic programming,
size
is a function from Ints or Strings or pairs to a size
defined
by type specific cases
This method has been deprecated in favor of macro assertion and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.
This method has been deprecated in favor of macro assertion and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.
This method has been deprecated in favor of macro assumption and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.
This method has been deprecated in favor of macro assumption and will be removed in a future version of ScalaTest. If you need this, please copy the source code into your own trait instead.
Please use 'an [Exception] should be thrownBy { ... }' syntax instead
This expect method has been deprecated. Please replace all invocations of expect with an identical invocation of assertResult instead.
This expect method has been deprecated. Please replace all invocations of expect with an identical invocation of assertResult instead.
This expectResult method has been deprecated. Please replace all invocations of expectResult with an identical invocation of assertResult instead.
This expectResult method has been deprecated. Please replace all invocations of expectResult with an identical invocation of assertResult instead.
Polymorphic function values
Ordinary Scala function values are monomorphic. shapeless, however, provides an encoding of polymorphic function values. It supports natural transformations, which are familiar from libraries like Scalaz