object SchemaShape extends Serializable
- Source
- SchemaShape.scala
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- SchemaShape
- Serializable
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Type Members
- final case class DiscoveryState[F[_]](toplevels: Map[String, Toplevel[F, _]], implementations: Implementations[F], positions: Map[String, List[Position[F, _]]]) extends Product with Serializable
- type Implementations[F[_]] = Map[String, Map[String, InterfaceImpl[F, _]]]
- sealed trait InterfaceImpl[+F[_], A] extends AnyRef
- final class PartiallyAppliedSchemaShape[F[_]] extends AnyVal
- sealed trait VisitNode[+F[_]] extends AnyRef
- sealed trait __TypeKind extends Product with Serializable
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def discover[F[_]](shape: SchemaShape[F, _, _, _]): DiscoveryState[F]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def introspect[F[_]](ss: SchemaShape[F, _, _, _]): NonEmptyList[(String, Field[F, Unit, _])]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def make[F[_]]: PartiallyAppliedSchemaShape[F]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def render[F[_]](shape: SchemaShape[F, _, _, _]): String
- def renderValueDoc[C](v: Value[AnyValue, C]): Doc
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unit[F[_]](query: NonEmptyList[(String, Field[F, Unit, _])], mutation: Option[NonEmptyList[(String, Field[F, Unit, _])]] = None, subscription: Option[NonEmptyList[(String, Field[F, Unit, _])]] = None, outputTypes: List[OutToplevel[F, _]] = Nil, inputTypes: List[InToplevel[_]] = Nil): SchemaShape[F, Unit, Unit, Unit]
- def visit[F[_], G[_], A](root: SchemaShape[F, _, _, _])(pf: PartialFunction[VisitNode[F], (G[A]) => G[A]])(implicit arg0: Monad[G], arg1: Parallel[G], D0: Defer[G], M: Monoid[A]): G[A]
A powerful fold over the schema.
A powerful fold over the schema. This functions lets the caller choose how to handle recursion explicitly, which allows Kleisli algebras (Local) to be possible.
For instance, counting the number of fields from parent to leaf:
case class State(leaf: String, fields: Int) type G[A] = Kleisli[WriterT[Eval, List[State], *], Int, A] val G = Monad[G] val L = Local[G, Int] val T = Tell[G, List[State]] object & { def unapply[A](a: A): Option[(A, A)] = Some((a, a)) } val states: List[State] = ScheamShape.visit[F, G](schema) { case VisitNode.FieldNode(_, _) => (rec: G[Unit]) => L.local(rec)(_ + 1) case VisitNode.OutNode((_: Scalar[?] | _: Enum[?]) & tl: Toplevel[F, ?]) => rec => L.ask[Int].flatMap(i => T.tell(List(State(tl.name, i)))) >> rec }.run(0).run.written.value
Consider that if we used state without being explicit about the recursion, we wouldn't be able to "pop" the field count.
An idiomatic combinator name may be
parRecFoldMapM
- def visitOnce[F[_], G[_], A](root: SchemaShape[F, _, _, _])(pf: PartialFunction[VisitNode[F], G[A]])(implicit arg0: Monad[G], arg1: Defer[G], A: Monoid[A]): G[A]
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object InterfaceImpl
- object VisitNode
- object __TypeKind extends Serializable