gql.SchemaShape$
See theSchemaShape companion class
object SchemaShape
Attributes
- Companion
- class
- Source
- SchemaShape.scala
- Graph
-
- Supertypes
- Self type
-
SchemaShape.type
Members list
Type members
Classlikes
final case class DiscoveryState[F[_]](toplevels: Map[String, Toplevel[F, _]], implementations: Implementations[F], positions: Map[String, List[Position[F, _]]])
Attributes
- Source
- SchemaShape.scala
- Supertypes
object InterfaceImpl
Attributes
- Companion
- trait
- Source
- SchemaShape.scala
- Supertypes
- Self type
-
InterfaceImpl.type
Attributes
- Companion
- object
- Source
- SchemaShape.scala
- Supertypes
- Known subtypes
-
final class PartiallyAppliedSchemaShape[F[_]](val dummy: Boolean) extends AnyVal
Attributes
- Source
- SchemaShape.scala
- Supertypes
-
class AnyValtrait Matchableclass Any
object VisitNode
Attributes
- Companion
- trait
- Source
- SchemaShape.scala
- Supertypes
- Self type
-
VisitNode.type
Attributes
- Companion
- object
- Source
- SchemaShape.scala
- Supertypes
- Known subtypes
object `__TypeKind`
Attributes
- Companion
- trait
- Source
- SchemaShape.scala
- Supertypes
- Self type
-
`__TypeKind`.type
sealed trait `__TypeKind` extends Product, Serializable
Attributes
- Companion
- object
- Source
- SchemaShape.scala
- Supertypes
- Known subtypes
Types
Attributes
- Source
- SchemaShape.scala
Inherited types
The names of the product elements
The name of the type
Value members
Concrete methods
Attributes
- Source
- SchemaShape.scala
Attributes
- Source
- SchemaShape.scala
Attributes
- Source
- SchemaShape.scala
Attributes
- Source
- SchemaShape.scala
Attributes
- Source
- SchemaShape.scala
def unit[F[_]](query: NonEmptyList[(String, Field[F, Unit, _])], mutation: Option[NonEmptyList[(String, Field[F, Unit, _])]], subscription: Option[NonEmptyList[(String, Field[F, Unit, _])]], outputTypes: List[OutToplevel[F, _]], inputTypes: List[InToplevel[_]]): SchemaShape[F, Unit, Unit, Unit]
Attributes
- Source
- SchemaShape.scala
def visit[F[_], G[_] : Parallel, A](root: SchemaShape[F, _, _, _])(pf: PartialFunction[VisitNode[F], G[A] => G[A]])(implicit evidence$8: Monad[G], evidence$9: 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
Attributes
- Source
- SchemaShape.scala
def visitOnce[F[_], G[_] : Defer, A](root: SchemaShape[F, _, _, _])(pf: PartialFunction[VisitNode[F], G[A]])(implicit evidence$10: Monad[G], evidence$11: Defer[G], A: Monoid[A]): G[A]
Attributes
- Source
- SchemaShape.scala
In this article