Class/Object

cats.tests

ListWrapper

Related Docs: object ListWrapper | package tests

Permalink

final case class ListWrapper[A](list: List[A]) extends AnyVal with Product with Serializable

This data type exists purely for testing.

The problem this type solves is to assist in picking up type class instances that have more general constraints.

For instance, OneAnd[*, F[_]] has a Monad instance if F[_] does too. By extension, it has an Applicative instance, since Applicative is a superclass of Monad.

However, if F[_] doesn't have a Monad instance but does have an Applicative instance (e.g. Validated), you can still get an Applicative instance for OneAnd[*, F[_]]. These two instances are different however, and it is a good idea to test to make sure all "variants" of the instances are lawful.

By providing this data type, we can have implicit search pick up a specific type class instance by asking for it explicitly in a block. Note that ListWrapper has no type class instances in implicit scope, save for ones related to testing (e.g. Eq, Arbitrary, Cogen).

{
  implicit val functor = ListWrapper.functor
  checkAll(..., ...)
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ListWrapper
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyVal
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ListWrapper(list: List[A])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  7. val list: List[A]

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyVal

Inherited from Any

Ungrouped