shapeless
package shapeless
- Alphabetic
- By Inheritance
- shapeless
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
sealed
trait
:+:[+H, +T <: Coproduct] extends Coproduct
Like Either, the :+: type defines a new type that can contain either H or T.
-
final
case class
::[+H, +T <: HList](head: H, tail: T) extends HList with Product with Serializable
Non-empty
HList
element type. -
trait
<:!<[A, B] extends Serializable
- Annotations
- @implicitNotFound( ... )
- trait =:!=[A, B] extends Serializable
-
trait
AdditiveCollection[Repr] extends Serializable
Evidence that
Repr
instances can be nested in aSized
.Evidence that
Repr
instances can be nested in aSized
.Should assert that a
Builder[_, Repr]
given n elements will result in a Repr of length n. -
trait
Annotation[A, T] extends Serializable
Evidence that type
T
has annotationA
, and provides an instance of the annotation.Evidence that type
T
has annotationA
, and provides an instance of the annotation.If type
T
has an annotation of typeA
, then an implicitAnnotation[A, T]
can be found, and itsapply
method provides an instance of the annotation.Example:
case class First(i: Int) @First(3) trait Something val somethingFirst = Annotation[First, Something].apply() assert(somethingFirst == First(3))
- class AnnotationMacros extends CaseClassMacros
-
trait
Annotations[A, T] extends DepFn0 with Serializable
Provides the annotations of type
A
of the fields or constructors of case class-like or sum typeT
.Provides the annotations of type
A
of the fields or constructors of case class-like or sum typeT
.If type
T
is case class-like, this type class inspects its fields and provides their annotations of typeA
. If typeT
is a sum type, its constructor types are looked for annotations.Type
Out
is an HList having the same number of elements asT
(number of fields ofT
ifT
is case class-like, or number of constructors ofT
if it is a sum type). It is made ofNone.type
(no annotation on corresponding field or constructor) andSome[A]
(corresponding field or constructor is annotated).Method
apply
provides an HList of typeOut
made ofNone
(corresponding field or constructor not annotated) orSome(annotation)
(corresponding field or constructor has annotationannotation
).Note that annotation types must be case class-like for this type class to take them into account.
Example:
case class First(s: String) case class CC(i: Int, @First("a") s: String) sealed trait Base @First("b") case class BaseI(i: Int) extends Base case class BaseS(s: String) extends Base val ccFirsts = Annotations[First, CC] val baseFirsts = Annotations[First, Base] // ccFirsts.Out is None.type :: Some[First] :: HNil // ccFirsts.apply() is // None :: Some(First("a")) :: HNil // baseFirsts.Out is Some[First] :: None.type :: HNil // baseFirsts.apply() is // Some(First("b")) :: None :: HNil
- class ApplyEverything[F <: Poly] extends AnyRef
- trait ApplyUnapplyFacet extends ProductISOFacet
-
trait
BasisConstraint[L <: HList, M <: HList] extends Serializable
Type class witnessing that every element of
L
is an element ofM
. -
sealed
trait
CNil extends Coproduct
The CNil type is used to terminate a 'list' of :+: alternatives.
The CNil type is used to terminate a 'list' of :+: alternatives.
Like the Nil constructor of List, it does not convey real information. This is achieved by not having any value for CNil.
This makes the type
Int :+: CNil
equivalent toInt
, because the right (Inr
) alternative of:+:
can not be constructed properly. -
final
case class
Cached[+T](value: T) extends AnyVal with Product with Serializable
Wraps a cached implicit
T
.Wraps a cached implicit
T
.Looking for an implicit
Cached[T]
first triggers a look for an implicitT
, caches the resulting tree, and returns it immediately and in subsequent look ups for an implicitCached[T]
. Thus, subsequent look ups do not trigger looking for an implicitT
, only returning the instance kept in cache.Beware that if the contexts in which two subsequent look ups are different, so that looking for a
T
in each of them doesn't return the same result, this change would be ignored by caching. Looking for aCached[T]
in the first context would put the implicitT
of this context in cache, and then looking for aCached[T]
in the second context would return the former instance from the first context. E.g.trait TC[T] { def msg: String } object First { implicit val tc: TC[Int] = new TC[Int] { val msg = "first" } def print() = println(implicitly[TC[Int]].msg) def printCached() = println(cached[TC[Int]].msg) } object Second { implicit val tc: TC[Int] = new TC[Int] { val msg = "second" } def print() = println(implicitly[TC[Int]].msg) def printCached() = println(cached[TC[Int]].msg) } First.print() Second.print() First.printCached() Second.printCached()
would print "first" then "second" (non cached
TC[Int]
instances), then "first" twice (first instance, returned the second time too through the cache). - class CachedImplicitMacros extends AnyRef
- class CachedMacros extends LazyMacros with OpenImplicitMacros
- trait CaseClassFacet extends AnyRef
- trait CaseClassMacros extends ReprTypes
- trait CaseInst extends AnyRef
- trait Cases extends AnyRef
- type Const[C] = AnyRef { type λ[T] = C }
-
sealed
trait
Coproduct extends Product with Serializable
Encodes a coproduct type, such as a sealed family of case classes.
Encodes a coproduct type, such as a sealed family of case classes.
Each constructor from the family gets an encoding in terms of nested Inr and Inl.
Which constructor is encoded as Inl() and which as Inr(Inl()) is determined by lexical order of the subclasses. This example illustrates the encoding:
scala> sealed trait Animal defined trait Animal scala> case class Cat(name: String, livesLeft: Int) extends Animal defined class Cat scala> case class Dog(name: String, bonesBuried: Int) extends Animal defined class Dog scala> case class Koala(name: String, leavesEaten: Int) extends Animal defined class Koala scala> case class Sloth(name: String, daysToClimbDownFromCurrentTree: Int) extends Animal defined class Sloth scala> val garfield = Cat("Garfield", 9) garfield: Cat = Cat(Garfield,9) scala> val odie = Dog("Odie", 3) odie: Dog = Dog(Odie,3) scala> val koala = Koala("foo", 10) koala: Koala = Koala(foo,10) scala> val sloth = Sloth("bar", 2) sloth: Sloth = Sloth(bar,2) scala> val genAnimal = Generic[Animal] genAnimal: shapeless.Generic[Animal]{type Repr = Cat :+: Dog :+: Koala :+: Sloth} = ... scala> def showCoproduct(o: Any) : String = o match { | case Inl(a) => "Inl(" + showCoproduct(a) + ")" | case Inr(a) => "Inr(" + showCoproduct(a) + ")" | case a => a.toString | } showCoproduct: (o: Any)String scala> showCoproduct(genAnimal.to(garfield)) res5: String = Inl(Cat(Garfield,9)) scala> showCoproduct(genAnimal.to(odie)) res6: String = Inr(Inl(Dog(Odie,3))) scala> showCoproduct(genAnimal.to(koala)) res7: String = Inr(Inr(Inl(Koala(foo,10)))) scala> showCoproduct(genAnimal.to(sloth)) res8: String = Inr(Inr(Inr(Inl(Sloth(bar,2))))) scala>
- trait CopyFacet extends CaseClassFacet
- trait Coselect[T] extends AnyRef
-
trait
Data[F, T, R] extends Serializable
Type class representing one-level generic queries.
- trait Data0 extends AnyRef
- trait Data1 extends Data0
-
trait
DataT[F, T] extends Serializable
Type class representing one-level generic transformations.
- trait DataT0 extends AnyRef
- trait DataT1 extends DataT0
-
trait
Default[T] extends DepFn0 with Serializable
Provides default values of case class-like types.
Provides default values of case class-like types.
The
Out
type parameter is an HList type whose length is the number of fields ofT
. Its elements correspond to the fields ofT
, in their original order. It is made ofNone.type
(no default value for this field) andSome[...]
(default value available for this field, with...
the type of the field). Note thatNone.type
andSome[...]
are more precise than simplyOption[...]
, so that the availability of default values can be used in type level calculations.The
apply
method returns an HList of typeOut
, withNone
elements corresponding to no default value available, andSome(defaultValue)
to default value available for the corresponding fields.Use like
case class CC(i: Int, s: String = "b") val default = Default[CC] // default.Out is None.type :: Some[String] :: HNil // default() returns // None :: Some("b") :: HNil, // typed as default.Out
- trait DefaultCaseClassDefns extends ApplyUnapplyFacet with ProductFacet with PolymorphicEqualityFacet with CopyFacet with ToStringFacet
- class DefaultMacros extends CaseClassMacros
- trait DefaultSymbolicLabelling[T] extends DepFn0 with Serializable
-
trait
DepFn0 extends AnyRef
Dependent nullary function type.
-
trait
DepFn1[T] extends AnyRef
Dependent unary function type.
-
trait
DepFn2[T, U] extends AnyRef
Dependent binary function type.
-
type
Everything[F <: Poly, K <: Poly, T] = Case[EverythingAux[F, K], ::[T, HNil]]
The SYB everything combinator
- class EverythingAux[F, K] extends Poly
-
type
Everywhere[F <: Poly, T] = Case[EverywhereAux[F], ::[T, HNil]]
The SYB everywhere combinator
- class EverywhereAux[F] extends Poly
-
trait
FieldOf[V] extends AnyRef
Field with values of type
V
.Field with values of type
V
.Record keys of this form should be objects which extend this trait. Keys may also be arbitrary singleton typed values, however keys of this form enforce the type of their values.
-
trait
FieldPoly extends Poly1
Polymorphic function that allows modifications on record fields while preserving the original key types.
-
trait
Fin[N <: Succ[_]] extends AnyRef
Base trait for type level finite numbers, i.e.
Base trait for type level finite numbers, i.e. numbers less than some bound N
-
case class
FinSucc[N <: Succ[_], P <: Fin[N]]() extends Fin[Succ[N]] with Product with Serializable
Encoding of successor.
-
case class
FinZero[N <: Succ[_]]() extends Fin[N] with Product with Serializable
Encoding of zero.
-
trait
FromProductArgs extends Dynamic
Trait supporting mapping HList arguments to argument lists, inverse of ProductArgs.
Trait supporting mapping HList arguments to argument lists, inverse of ProductArgs.
Mixing in this trait enables method applications of the form,
lhs.methodProduct(23 :: "foo" :: true)
to be rewritten as,
lhs.method(23, "foo", true)
ie. the HList argument is used to obtain arguments for a target method (the called method named minus the "Product" suffix) in sequence and the application is rewritten to an application of the target method
-
trait
FromRecordArgs extends Dynamic
Trait supporting mapping record arguments to named argument lists, inverse of RecordArgs.
Trait supporting mapping record arguments to named argument lists, inverse of RecordArgs.
Mixing in this trait enables method applications of the form,
lhs.methodRecord('x ->> 23 :: 'y ->> "foo" :: 'z ->> true :: HNil)
to be rewritten as,
lhs.method(x = 23, y = "foo", z = true)
ie. the record argument is used to look up arguments for a target method (the called method named minus the "Record" suffix) by name and type and the application is rewritten to an application of the target method
-
trait
Generic[T] extends Serializable
Represents the ability to convert from a concrete type (e.g.
Represents the ability to convert from a concrete type (e.g. a case class) to a generic (HList / Coproduct} based) representation of the type.
For example:
scala> sealed trait Animal defined trait Animal scala> case class Cat(name: String, livesLeft: Int) extends Animal defined class Cat scala> case class Dog(name: String, bonesHidden: Int) extends Animal defined class Dog scala> val genCat = Generic[Cat] genCat: shapeless.Generic[Cat]{ type Repr = String :: Int :: HNil } = ... scala> val genDog = Generic[Dog] genDog: shapeless.Generic[Dog]{ type Repr = String :: Int :: HNil } = ... scala> val garfield = Cat("Garfield", 9) garfield: Cat = Cat(Garfield,9) scala> val genGarfield = genCat.to(garfield) genGarfield: genCat.Repr = Garfield :: 9 :: HNil scala> val reconstructed = genCat.from(genGarfield) reconstructed: Cat = Cat(Garfield,9) scala> reconstructed == garfield res0: Boolean = true
Note that constituents of Cat and Dog are exactly the same - a String and an Int. So we could do:
scala> val odieAsCat = genCat.from(genDog.to(odie)) odieAsCat: Cat = Cat(odie,3)
This is quite useful in certain cases, such as copying from one object type to another, as in schema evolution.
Note that the generic representation depends on the type at which we instantiate Generic. In the example above we instantiated it at Cat and at Dog, and so the generic representation gave the minimal constituents of each of those.
However, if we instantiate Generic[Animal] instead the generic representation would encode the Cat-ness or Dog-ness of the instance as well (see Coproduct for details of the encoding):
scala> genDog.to(odie) res9: genDog.Repr = odie :: 3 :: HNil scala> val genAnimal = Generic[Animal] genAnimal: shapeless.Generic[Animal]{ type Repr = Cat :+: Dog :+: CNil } = ... scala> genAnimal.to(odie) res8: genAnimal.Repr = Dog(odie,3) scala> genAnimal.to(odie) match { case Inr(Inl(dog)) => dog; case _ => null } res9: Dog = Dog(odie,3)
Inr and Inl are shapeless.Coproduct constructors. Shapeless constructs each class representation as a sort of "nested Either" using Coproduct. So in our example, genAnimal would essentially encode garfield as Inl(garfield) and odie as Inr(Inl(odie)). Please see shapeless.Coproduct for more details. }}}
- T
An immutable data type that has a canonical way of constructing and deconstructing instances (e.g. via apply / unapply). Sealed families of case classes work best.
- trait Generic1[F[_], FR[_[_]]] extends Serializable
- trait Generic10 extends AnyRef
- class Generic1Macros extends CaseClassMacros
- class GenericMacros extends CaseClassMacros
-
sealed
trait
HList extends Product with Serializable
HList
ADT base trait. -
class
HMap[R[_, _]] extends Poly1
Heterogenous map with type-level key/value associations that are fixed by an arbitrary relation
R
.Heterogenous map with type-level key/value associations that are fixed by an arbitrary relation
R
.HMap
s extendPoly
and hence are also polymorphic function values with type-specific cases corresponding to the map's type-level key/value associations. - class HMapBuilder[R[_, _]] extends AnyRef
-
sealed
trait
HNil extends HList
Empty
HList
element type. - class HasCoproductGeneric[T] extends Serializable
- class HasProductGeneric[T] extends Serializable
- type Id[+T] = T
- trait InferProduct[C <: Coproduct, K] extends Serializable
-
final
case class
Inl[+H, +T <: Coproduct](head: H) extends :+:[H, T] with Product with Serializable
H :+: T
can either beH
orT
.H :+: T
can either beH
orT
. In this case it isH
. -
final
case class
Inr[+H, +T <: Coproduct](tail: T) extends :+:[H, T] with Product with Serializable
H :+: T
can either beH
orT
.H :+: T
can either beH
orT
. In this case it isT
. - trait IsCCons1[L[_], FH[_[_]], FT[_[_]]] extends Serializable
- trait IsCCons10 extends AnyRef
- class IsCCons1Macros extends IsCons1Macros
- trait IsCons1Macros extends CaseClassMacros
-
trait
IsDistinctConstraint[L <: HList] extends Serializable
Type class witnessing that all elements of
L
have distinct typesType class witnessing that all elements of
L
have distinct types- Annotations
- @implicitNotFound( ... )
- trait IsHCons1[L[_], FH[_[_]], FT[_[_]]] extends Serializable
- trait IsHCons10 extends AnyRef
- class IsHCons1Macros extends IsCons1Macros
- class IsTuple[T] extends Serializable
-
trait
KeyConstraint[L <: HList, M <: HList] extends Serializable
Type class witnessing that every element of
L
is of the formFieldType[K, V]
whereK
is an element ofM
. - trait LPLens[S, A] extends Dynamic with Serializable
- trait LPPath[T <: HList] extends Dynamic
- trait LPPrism[S, A] extends Dynamic with Serializable
-
trait
LUBConstraint[L <: HList, B] extends Serializable
Type class witnessing that every element of
L
is a subtype ofB
. -
trait
LabelledGeneric[T] extends Serializable
LabelledGeneric is similar to Generic, but includes information about field names or class names in addition to the raw structure.
LabelledGeneric is similar to Generic, but includes information about field names or class names in addition to the raw structure.
Continuing the example from shapeless.Generic, we use LabelledGeneric to convert an object to an shapeless.HList:
scala> val lgenDog = LabelledGeneric[Dog] lgenDog: shapeless.LabelledGeneric[Dog]{ type Repr = Record.`'name -> String, 'bonesHidden -> Int`.T } = ... scala> lgenDog.to(odie) res15: lgenDog.Repr = odie :: 3 :: HNil
Note that the representation does not include the labels! The labels are actually encoded in the generic type representation using shapeless.Witness types.
As with shapeless.Generic, the representation for Animal captures the subclass embedding rather than the fields in the class, using shapeless.Coproduct:
scala> val lgenAnimal = LabelledGeneric[Animal] lgenAnimal: shapeless.LabelledGeneric[Animal]{ type Repr = Union.`'Cat -> Cat, 'Dog -> Dog`.T } = ... scala> lgenAnimal.to(odie) res16: lgenAnimal.Repr = Dog(odie,3) scala> genAnimal.to(odie) match { case Inr(Inl(dog)) => dog ; case _ => ???} res19: Dog = Dog(odie,3)
- T
the type which this instance can convert to and from a labelled generic representation
- class LabelledMacros extends SingletonTypeUtils with CaseClassMacros
-
trait
LabelledProductTypeClass[C[_]] extends Serializable
A type class abstracting over the
product
operation of type classes over types of kind*
, as well as deriving instances using an isomorphism.A type class abstracting over the
product
operation of type classes over types of kind*
, as well as deriving instances using an isomorphism. Refines ProductTypeClass with the addition of runtimeString
labels corresponding to the names of the product elements. - trait LabelledProductTypeClassCompanion[C[_]] extends Serializable
-
trait
LabelledTypeClass[C[_]] extends LabelledProductTypeClass[C]
A type class additionally abstracting over the
coproduct
operation of type classes over types of kind*
.A type class additionally abstracting over the
coproduct
operation of type classes over types of kind*
.Name hints can be safely ignored.
- trait LabelledTypeClassCompanion[C[_]] extends LabelledProductTypeClassCompanion[C]
-
trait
Lazy[+T] extends Serializable
Wraps a lazily computed value.
Wraps a lazily computed value. Also circumvents cycles during implicit search, or wrong implicit divergences as illustrated below, and holds the corresponding implicit value lazily.
The following implicit search sometimes fails to compile, because of a wrongly reported implicit divergence,
case class ListCC(list: List[CC]) case class CC(i: Int, s: String) trait TC[T] object TC { implicit def intTC: TC[Int] = ??? implicit def stringTC: TC[String] = ??? implicit def listTC[T](implicit underlying: TC[T]): TC[List[T]] = ??? implicit def genericTC[F, G](implicit gen: Generic.Aux[F, G], underlying: TC[G] ): TC[F] = ??? implicit def hnilTC: TC[HNil] = ??? implicit def hconsTC[H, T <: HList](implicit headTC: TC[H], tailTC: TC[T] ): TC[H :: T] = ??? } implicitly[TC[ListCC]] // fails with: diverging implicit expansion for type TC[ListCC]
This wrongly reported implicit divergence can be circumvented by wrapping some of the implicit values in
Lazy
,case class ListCC(list: List[CC]) case class CC(i: Int, s: String) trait TC[T] object TC { implicit def intTC: TC[Int] = ??? implicit def stringTC: TC[String] = ??? implicit def listTC[T](implicit underlying: TC[T]): TC[List[T]] = ??? implicit def genericTC[F, G](implicit gen: Generic.Aux[F, G], underlying: Lazy[TC[G]] // wrapped in Lazy ): TC[F] = ??? implicit def hnilTC: TC[HNil] = ??? implicit def hconsTC[H, T <: HList](implicit headTC: Lazy[TC[H]], // wrapped in Lazy tailTC: TC[T] ): TC[H :: T] = ??? } implicitly[TC[ListCC]]
When looking for an implicit
Lazy[TC[T]]
, theLazy.mkLazy
macro will itself trigger the implicit search for aTC[T]
. If this search itself triggers searches for types wrapped inLazy
, these will be done only once, their result put in alazy val
, and a reference to thislazy val
will be returned as the corresponding value. It will then wrap all the resulting values together, and return a reference to the first one.E.g. with the above example definitions, when looking up for an implicit
TC[ListCC]
, the returned tree roughly looks likeTC.genericTC( Generic[ListCC], // actually, the tree returned by Generic.materialize, not written here for the sake of brevity Lazy { lazy val impl1: TC[List[CC] :: HNil] = TC.hconsTC( Lazy(impl2), TC.hnilTC ) lazy val impl2: TC[List[CC]] = TC.listTC(TC.genericTC( Generic[CC], // actually, the tree returned by Generic.materialize Lazy(impl1) // cycles to the initial TC[List[CC] :: HNil] )) impl1 } )
- Annotations
- @implicitNotFound( ... )
- class LazyMacros extends CaseClassMacros with OpenImplicitMacros with LowPriorityTypes
- trait LazyMacrosCompat extends AnyRef
- class LazyMacrosRef extends AnyRef
- trait Lens[S, A] extends LPLens[S, A]
-
sealed
trait
LowPriority extends Serializable
Evidence that no implicit instance of the same type as the one being currently searched is available elsewhere.
Evidence that no implicit instance of the same type as the one being currently searched is available elsewhere.
Added to an implicit def like
implicit def genericThing[F, G] (implicit ev: LowPriority, gen: Generic.Aux[F, G], underlying: Thing[G] ): Thing[F] = ???
it prevents
genericThing
to provide an instance ofThing[F]
if an implicit one is already available elsewhere. This effectively givesgenericThing
a lower priority than the already existing implicits - without having to deal with cumbersome priority scoping. - class LowPriorityMacros extends OpenImplicitMacros with LowPriorityTypes
- trait LowPriorityMkPathOptic extends AnyRef
- trait LowPriorityMkSelectDynamicOptic extends AnyRef
- trait LowPrioritySegment extends AnyRef
- trait LowPrioritySized extends AnyRef
- trait LowPriorityTypeable extends AnyRef
- trait LowPriorityTypes extends AnyRef
- trait LowPriorityUnaryTCConstraint extends LowPriorityUnaryTCConstraint0
- trait LowPriorityUnaryTCConstraint0 extends AnyRef
- trait LowPriorityUnwrappedInstances extends AnyRef
- trait LowPriorityWitnessWith extends AnyRef
-
trait
Lub[-A, -B, Out] extends Serializable
Type class witnessing the least upper bound of a pair of types and providing conversions from each to their common supertype.
- trait MkCoproductSelectPrism[C <: Coproduct, T] extends Serializable
- trait MkCtorPrism[A, B] extends Serializable
- trait MkFieldLens[A, K] extends Serializable
- trait MkGenericLens[T] extends Serializable
- trait MkHListNthLens[L <: HList, N <: Nat] extends Serializable
- trait MkHListSelectLens[L <: HList, U] extends Serializable
- trait MkLabelledGenericLens[T] extends Serializable
- trait MkNthFieldLens[A, N <: Nat] extends Serializable
- trait MkPathOptic[S, P <: HList] extends Serializable
- trait MkRecordSelectLens[R <: HList, K] extends Serializable
- trait MkSelectDynamicOptic[R, A, K, B] extends Serializable
-
trait
Nat extends AnyRef
Base trait for type level natural numbers.
- trait NatMacroDefns extends AnyRef
- class NatMacros extends NatMacroDefns
-
trait
NatProductArgs extends Dynamic
Trait supporting mapping dynamic argument lists of Ints to HList of Nat arguments.
Trait supporting mapping dynamic argument lists of Ints to HList of Nat arguments.
Mixing in this trait enables method applications of the form,
lhs.method(1, 2, 3)
to be rewritten as,
lhs.methodProduct(_1 :: _2 :: _3)
ie. the arguments are rewritten as HList elements of Nat and the application is rewritten to an application of an implementing method (identified by the "Product" suffix) which accepts a single HList of Int argument.
- trait NatTRel0 extends AnyRef
- trait NatWith[TC[_ <: Nat]] extends AnyRef
- trait Nats extends AnyRef
-
trait
NotContainsConstraint[L <: HList, U] extends Serializable
Type class witnessing that
L
doesn't contain elements of typeU
Type class witnessing that
L
doesn't contain elements of typeU
- Annotations
- @implicitNotFound( ... )
- trait OpenImplicitMacros extends AnyRef
- trait OpticComposer[L, R] extends Serializable
-
sealed
trait
OrElse[+A, +B] extends AnyRef
Like
Option.orElse
on the type level and likeEither
on the value level.Like
Option.orElse
on the type level and likeEither
on the value level.Instead of left and right constructors
OrElse
has primary and secondary implicits that lazily try to resolve first a value of typeA
or otherwise a value of typeB
. - case class Orphan[F[_], D, T](instance: F[T]) extends Product with Serializable
- trait OrphanDeriver[F[_], D] extends AnyRef
- class OrphanMacros extends CaseClassMacros
- trait Path[T <: HList] extends LPPath[T]
-
trait
Poly extends PolyApply with Serializable
Base trait for polymorphic values.
-
trait
Poly0 extends Poly
Trait simplifying the creation of polymorphic values.
- trait Poly1 extends Poly
- trait Poly10 extends Poly
- trait Poly11 extends Poly
- trait Poly12 extends Poly
- trait Poly13 extends Poly
- trait Poly14 extends Poly
- trait Poly15 extends Poly
- trait Poly16 extends Poly
- trait Poly17 extends Poly
- trait Poly18 extends Poly
- trait Poly19 extends Poly
- trait Poly2 extends Poly
- trait Poly20 extends Poly
- trait Poly21 extends Poly
- trait Poly22 extends Poly
- trait Poly3 extends Poly
- trait Poly4 extends Poly
- trait Poly5 extends Poly
- trait Poly6 extends Poly
- trait Poly7 extends Poly
- trait Poly8 extends Poly
- trait Poly9 extends Poly
- trait PolyApply extends AnyRef
- trait PolyInst extends AnyRef
- class PolyMacros extends AnyRef
- trait PolymorphicEqualityFacet extends ProductISOFacet
- final class Primary[+A] extends OrElse[A, Nothing]
- trait Prism[S, A] extends LPPrism[S, A]
-
trait
ProductArgs extends Dynamic
Trait supporting mapping dynamic argument lists to HList arguments.
Trait supporting mapping dynamic argument lists to HList arguments.
Mixing in this trait enables method applications of the form,
lhs.method(23, "foo", true)
to be rewritten as,
lhs.methodProduct(23 :: "foo" :: true)
ie. the arguments are rewritten as HList elements and the application is rewritten to an application of an implementing method (identified by the "Product" suffix) which accepts a single HList argument.
- trait ProductFacet extends ProductISOFacet
- trait ProductISOFacet extends CaseClassFacet
- trait ProductLensBuilder[C, P <: Product] extends Lens[C, P] with Serializable
- class ProductMacros extends SingletonTypeUtils with NatMacroDefns
- trait ProductPrismBuilder[C, P <: Product] extends Prism[C, P] with Serializable
-
trait
ProductTypeClass[C[_]] extends Serializable
A type class abstracting over the
product
operation of type classes over types of kind*
, as well as deriving instances using an isomorphism. - trait ProductTypeClassCompanion[C[_]] extends Serializable
-
trait
RecordArgs extends Dynamic
Trait supporting mapping named argument lists to record arguments.
Trait supporting mapping named argument lists to record arguments.
Mixing in this trait enables method applications of the form,
lhs.method(x = 23, y = "foo", z = true)
to be rewritten as,
lhs.methodRecord('x ->> 23 :: 'y ->> "foo", 'z ->> true)
ie. the named arguments are rewritten as record fields with the argument name encoded as a singleton-typed
Symbol
and the application is rewritten to an application of an implementing method (identified by the "Record" suffix) which accepts a single record argument. - class RecordMacros extends AnyRef
-
trait
Refute[T] extends AnyRef
Evidence that no implicit instance of type
T
is available - trait ReprTypes extends AnyRef
- final class Secondary[+B] extends OrElse[Nothing, B]
- trait Segment[P, S, T <: HList] extends AnyRef
- trait Select[T] extends AnyRef
-
trait
SingletonProductArgs extends Dynamic
Trait supporting mapping dynamic argument lists to singleton-typed HList arguments.
Trait supporting mapping dynamic argument lists to singleton-typed HList arguments.
Mixing in this trait enables method applications of the form,
lhs.method(23, "foo", true)
to be rewritten as,
lhs.methodProduct(23.narrow :: "foo".narrow :: true.narrow)
ie. the arguments are rewritten as singleton-typed HList elements and the application is rewritten to an application of an implementing method (identified by the "Product" suffix) which accepts a single HList argument.
- class SingletonTypeMacros extends SingletonTypeUtils with NatMacroDefns
- trait SingletonTypeUtils extends ReprTypes
-
final
class
Sized[+Repr, L <: Nat] extends AnyRef
Wrapper for a collection type witnessing that it has the statically specified length.
Wrapper for a collection type witnessing that it has the statically specified length. Can be applied to any type which can be viewed as a
GenTraversableLike
, ie. standard collections,Array
s,String
s etc. - class SizedBuilder[CC[_]] extends AnyRef
-
class
SizedOps[A0, Repr, L <: Nat] extends AnyRef
Carrier for
Sized
operations.Carrier for
Sized
operations.These operations are implemented here as extension methods of the minimal
Sized
type to avoid issues that would otherwise be caused by its covariance. - trait Split1[L[_], FO[_[_]], FI[_[_]]] extends Serializable
- trait Split10 extends AnyRef
- class Split1Macros extends CaseClassMacros
-
trait
Strict[+T] extends Serializable
Wraps an eagerly computed value.
Wraps an eagerly computed value. Prevents wrongly reported implicit divergence, like
Lazy
does, but, unlike it, does not circumvent implicit cycles.Creation of
Lazy
instances usually triggers the creation of an anonymous class, to compute the wrapped value (e.g. with the by-name argument ofLazy.apply
).Strict
avoids that, which can lead to less overhead during compilation. -
case class
Succ[P <: Nat]() extends Nat with Product with Serializable
Encoding of successor.
- class TestMacros extends AnyRef
- class TheMacros extends AnyRef
- trait ToStringFacet extends ProductFacet
- trait TupleTypeableInstances extends AnyRef
-
trait
TypeCase[T] extends Serializable
Extractor for use of
Typeable
in pattern matching.Extractor for use of
Typeable
in pattern matching.Thanks to Stacy Curl for the idea.
-
trait
TypeClass[C[_]] extends ProductTypeClass[C]
A type class additionally abstracting over the
coproduct
operation of type classes over types of kind*
. - trait TypeClassCompanion[C[_]] extends ProductTypeClassCompanion[C]
-
trait
Typeable[T] extends Serializable
Type class supporting type safe cast.
- class TypeableMacros extends SingletonTypeUtils
-
trait
UnaryTCConstraint[L <: HList, TC[_]] extends Serializable
Type class witnessing that every element of
L
hasTC
as its outer type constructor. - class UnionMacros extends AnyRef
-
trait
Unpack1[-PP, FF[_], A] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A]
for some higher kinded typeFF[_]
and type(s)A
. -
trait
Unpack10[-PP, FF[_, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J
. -
trait
Unpack11[-PP, FF[_, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K
. -
trait
Unpack12[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L
. -
trait
Unpack13[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M
. -
trait
Unpack14[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N
. -
trait
Unpack15[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
. -
trait
Unpack16[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P
. -
trait
Unpack17[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q
. -
trait
Unpack18[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R
. -
trait
Unpack19[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S
. -
trait
Unpack2[-PP, FF[_, _], A, B] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B]
for some higher kinded typeFF[_, _]
and type(s)A, B
. -
trait
Unpack20[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T
. -
trait
Unpack21[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U
. -
trait
Unpack22[-PP, FF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V
. -
trait
Unpack3[-PP, FF[_, _, _], A, B, C] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C]
for some higher kinded typeFF[_, _, _]
and type(s)A, B, C
. -
trait
Unpack4[-PP, FF[_, _, _, _], A, B, C, D] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D]
for some higher kinded typeFF[_, _, _, _]
and type(s)A, B, C, D
. -
trait
Unpack5[-PP, FF[_, _, _, _, _], A, B, C, D, E] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E]
for some higher kinded typeFF[_, _, _, _, _]
and type(s)A, B, C, D, E
. -
trait
Unpack6[-PP, FF[_, _, _, _, _, _], A, B, C, D, E, F] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F]
for some higher kinded typeFF[_, _, _, _, _, _]
and type(s)A, B, C, D, E, F
. -
trait
Unpack7[-PP, FF[_, _, _, _, _, _, _], A, B, C, D, E, F, G] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G]
for some higher kinded typeFF[_, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G
. -
trait
Unpack8[-PP, FF[_, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H]
for some higher kinded typeFF[_, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H
. -
trait
Unpack9[-PP, FF[_, _, _, _, _, _, _, _, _], A, B, C, D, E, F, G, H, I] extends AnyRef
Type class witnessing that type
PP
is equal toFF[A, B, C, D, E, F, G, H, I]
for some higher kinded typeFF[_, _, _, _, _, _, _, _, _]
and type(s)A, B, C, D, E, F, G, H, I
. - trait Unwrapped[W] extends Serializable
- trait UnwrappedInstances extends LowPriorityUnwrappedInstances
-
trait
ValueConstraint[L <: HList, M <: HList] extends Serializable
Type class witnessing that every element of
L
is of the formFieldType[K, V]
whereV
is an element ofM
. -
trait
Widen[T] extends DepFn1[T]
Provides the widen type of a singleton type.
Provides the widen type of a singleton type.
Type member
Out
of an implicitly availableWitness[T]
instance is the widen type ofT
, and theapply
method explicitly converts aT
to anOut
.E.g. if
T
is
.TWitness.
2
is,
OutInt
.It somehow complements
Witness
, providing the corresponding non-witnessed standard type, if any.Example of use, {{ val w = Widen[Witness.
2
.T] // w.Out is Int // w(2) is typed as Int }} -
trait
Witness extends Serializable
Provides the value corresponding to a singleton type.
Provides the value corresponding to a singleton type.
See SIP-23 for a related proposed language change.
- trait WitnessWith[TC[_]] extends Witness
- case class WrappedOrphan[T](instance: T) extends Product with Serializable
-
case class
Zipper[C, L <: HList, R <: HList, P](prefix: L, suffix: R, parent: P) extends Product with Serializable
Generic Zipper for any type with a representation via
Generic
. -
class
_0 extends Nat with Serializable
Encoding of zero.
- class nonGeneric extends scala.annotation.Annotation with StaticAnnotation
- type |¬|[T] = AnyRef { type λ[U] = U <:!< T }
- type |∨|[T, U] = AnyRef { type λ[X] = shapeless.package.¬¬[X] <:< (T ∨ U) }
-
class
~?>[K[_], V[_]] extends Serializable
Type class witnessing the existence of a natural transformation between
K[_]
andV[_]
.Type class witnessing the existence of a natural transformation between
K[_]
andV[_]
.Use this trait to represent an
HMap
relation of the formK[T]
maps toV[T]
. - type ¬[T] = (T) ⇒ Nothing
- type ¬¬[T] = (¬[T]) ⇒ Nothing
- type ∀[P[_]] = (∃[[X](P[X]) ⇒ Nothing]) ⇒ Nothing
- type ∃[P[_]] = P[_]
- type ∧[T, U] = T with U
- type ∨[T, U] = (∧[¬[T], ¬[U]]) ⇒ Nothing
Value Members
- val ^: Path.type
- macro def cachedImplicit[T]: T
- def everything(f: Poly): ApplyEverything[f.type]
- def everywhere(f: Poly): EverywhereAux[f.type]
-
val
fin: Fin.type
'Fin'
- val lens: OpticDefns.type
-
val
nat: Nat.type
Nat
literals - implicit def neq[A, B]: =:!=[A, B]
- implicit def neqAmbig1[A]: =:!=[A, A]
- implicit def neqAmbig2[A]: =:!=[A, A]
- implicit def nsub[A, B]: <:!<[A, B]
- implicit def nsubAmbig1[A, B >: A]: <:!<[A, B]
- implicit def nsubAmbig2[A, B >: A]: <:!<[A, B]
-
val
optic: OpticDefns.type
Optic
definitions -
val
poly: PolyDefns.type
Poly
definitions - val prism: OpticDefns.type
- def unexpected: Nothing
- object AdditiveCollection extends Serializable
- object Annotation extends Serializable
- object Annotations extends Serializable
- object BasisConstraint extends Serializable
-
object
BuildInfo extends Product with Serializable
This object was generated by sbt-buildinfo.
- object Cached extends Serializable
- object CachedMacros
- object Coproduct extends Dynamic with Serializable
- object Data extends Data1 with Serializable
- object DataT extends DataT1 with Serializable
- object Default extends Serializable
- object DefaultSymbolicLabelling extends Serializable
- object EverythingAux extends Serializable
- object EverywhereAux extends Serializable
- object Fin
-
object
Generic extends Serializable
The companion object for the Generic trait provides a way of obtaining a Generic[T] instance for some T.
The companion object for the Generic trait provides a way of obtaining a Generic[T] instance for some T. In addition, it defines Generic.Aux, which is an important implementation technique that can be generally useful.
- object Generic1 extends Generic10 with Serializable
- object HList extends Dynamic with Serializable
- object HMap extends Serializable
-
object
HNil extends HNil with Product with Serializable
Empty
HList
value. - object HasCoproductGeneric extends Serializable
- object HasProductGeneric extends Serializable
- object InferProduct extends Serializable
- object IsCCons1 extends IsCCons10 with Serializable
- object IsDistinctConstraint extends Serializable
- object IsHCons1 extends IsHCons10 with Serializable
- object IsTuple extends Serializable
- object KeyConstraint extends Serializable
- object LUBConstraint extends Serializable
- object LabelledGeneric extends Serializable
- object Lazy extends Serializable
- object LazyMacros extends LazyMacrosCompat
- object LowPriority extends Serializable
- object Lub extends Serializable
- object MkCoproductSelectPrism extends Serializable
- object MkCtorPrism extends Serializable
- object MkFieldLens extends Serializable
- object MkGenericLens extends Serializable
- object MkHListNthLens extends Serializable
- object MkHListSelectLens extends Serializable
- object MkLabelledGenericLens extends Serializable
- object MkNthFieldLens extends Serializable
- object MkPathOptic extends LowPriorityMkPathOptic with Serializable
- object MkRecordSelectLens extends Serializable
- object MkSelectDynamicOptic extends LowPriorityMkSelectDynamicOptic with Serializable
-
object
Nat extends Nats
Type level encoding of the natural numbers.
- object NatWith
- object NotContainsConstraint extends Serializable
- object OpticComposer extends Serializable
- object OpticDefns
- object OrElse extends OrElse0
- object Orphan extends Serializable
- object Path extends Path[HNil]
-
object
Poly extends PolyInst with Serializable
Provides implicit conversions from polymorphic function values to monomorphic function values, eg.
Provides implicit conversions from polymorphic function values to monomorphic function values, eg. for use as arguments to ordinary higher order functions.
- object Poly1 extends Poly1Builder[HNil] with Serializable
- object Poly10 extends Poly10Builder[HNil] with Serializable
- object Poly11 extends Poly11Builder[HNil] with Serializable
- object Poly12 extends Poly12Builder[HNil] with Serializable
- object Poly13 extends Poly13Builder[HNil] with Serializable
- object Poly14 extends Poly14Builder[HNil] with Serializable
- object Poly15 extends Poly15Builder[HNil] with Serializable
- object Poly16 extends Poly16Builder[HNil] with Serializable
- object Poly17 extends Poly17Builder[HNil] with Serializable
- object Poly18 extends Poly18Builder[HNil] with Serializable
- object Poly19 extends Poly19Builder[HNil] with Serializable
- object Poly2 extends Poly2Builder[HNil] with Serializable
- object Poly20 extends Poly20Builder[HNil] with Serializable
- object Poly21 extends Poly21Builder[HNil] with Serializable
- object Poly22 extends Poly22Builder[HNil] with Serializable
- object Poly3 extends Poly3Builder[HNil] with Serializable
- object Poly4 extends Poly4Builder[HNil] with Serializable
- object Poly5 extends Poly5Builder[HNil] with Serializable
- object Poly6 extends Poly6Builder[HNil] with Serializable
- object Poly7 extends Poly7Builder[HNil] with Serializable
- object Poly8 extends Poly8Builder[HNil] with Serializable
- object Poly9 extends Poly9Builder[HNil] with Serializable
- object PolyDefns extends Cases
-
object
PolyNBuilders
Provides elegant syntax for creating polys from functions
- object Refute
- object Segment extends LowPrioritySegment
- object Sized extends LowPrioritySized
- object Split1 extends Split10 with Serializable
- object Strict extends Serializable
- object Tuple
- object TypeCase extends Serializable
- object TypeOf extends Dynamic
-
object
Typeable extends TupleTypeableInstances with LowPriorityTypeable with Serializable
Provides instances of
Typeable
.Provides instances of
Typeable
. Also provides an implicit conversion which enhances arbitrary values with acast[T]
method. - object UnaryTCConstraint extends LowPriorityUnaryTCConstraint with Serializable
- object Unpack1
- object Unpack10
- object Unpack11
- object Unpack12
- object Unpack13
- object Unpack14
- object Unpack15
- object Unpack16
- object Unpack17
- object Unpack18
- object Unpack19
- object Unpack2
- object Unpack20
- object Unpack21
- object Unpack22
- object Unpack3
- object Unpack4
- object Unpack5
- object Unpack6
- object Unpack7
- object Unpack8
- object Unpack9
- object Unwrapped extends UnwrappedInstances with Serializable
- object ValueConstraint extends Serializable
- object Widen
- object Witness extends Dynamic with Serializable
- object WitnessWith extends LowPriorityWitnessWith with Serializable
- object WrappedOrphan extends Serializable
- object Zipper extends Serializable
- object labelled
- object lazily
- object newtype
-
object
productElements extends Poly1
Higher ranked function which converts products to
HLists
. -
object
record
Record operations on
HList
's with field-like elements. - object tag
-
object
the extends Dynamic
An enhanced alternative to
Predef.implicitly
.An enhanced alternative to
Predef.implicitly
.Used as a term
the[T]
yields the unique implicit value of typeT
in the current implicit scope, if any. It is a compile time error if there is no such value. Its primary advantage overPredef.implicitly
is that it will preserve any refinement that the implicit definition has, resulting in more precisely typed, and hence often more useful, values,scala> trait Foo { type T ; val t: T } defined trait Foo scala> implicit val intFoo: Foo { type T = Int } = new Foo { type T = Int ; val t = 23 } intFoo: Foo{type T = Int} = $anon$1@6067b682 scala> implicitly[Foo].t // implicitly loses precision res0: Foo#T = 23 scala> implicitly[Foo].t+13 <console>:13: error: type mismatch; found : Int(13) required: String implicitly[Foo].t+13 ^ scala> the[Foo].t // the retains it res1: Int = 23 scala> the[Foo].t+13 res2: Int = 36
Unlike
implicitly
,the
can also be used in type position, thanks to a trick due to Denys Shabalin (@den_sh) and Eugene Burmako (@xeno_by). Here we use a combination ofselectDynamic
and backticks to embed a type in a path which appears to the compiler as stable,scala> val i: implicitly[Foo].T = 23 // syntax error <console>:1: error: ';' expected but '.' found. val i: implicitly[Foo].T = 23 ^ scala> val i: the.`Foo`.T = 23 // OK i: Int = 23
-
object
tupled extends Poly1
Higher ranked function which converts
HLists
to tuples. - object union
- object ~?> extends NatTRel0 with Serializable