io.dylemma.spac.interop.fs2

Provides implicits to allow for interop between the core SPaC classes and fs2 / cats-effect.

  • Parser gets toPipe and parseF
  • Transformer gets toPipe
  • Source gets toResource and toStream

Attributes

Members list

Type members

Classlikes

final implicit class ParserFs2Ops[In, Out](parser: Parser[In, Out]) extends AnyVal

Since Parser is by design a stream consumer, we can provide the parseF helper which consumes a fs2.Stream in an effectful way. We can also provide the toPipe method, which transforms an input fs2.Stream to a new stream which emits exactly one value or raises an error.

Since Parser is by design a stream consumer, we can provide the parseF helper which consumes a fs2.Stream in an effectful way. We can also provide the toPipe method, which transforms an input fs2.Stream to a new stream which emits exactly one value or raises an error.

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class SourceFs2Ops[A](source: Source[A]) extends AnyVal

Since Source is a synchronous-only encoding of the Resource pattern, it can be converted to a cats.effect.Resource by suspending its open and close operations in a Sync effect type F, yielding an Iterator[A] as its value.

Since Source is a synchronous-only encoding of the Resource pattern, it can be converted to a cats.effect.Resource by suspending its open and close operations in a Sync effect type F, yielding an Iterator[A] as its value.

This can be taken a step further by lifting that Resource to a fs2.Stream and wrapping the provided Iterator as a stream, to treat the whole Source[A] as a fs2.Stream[F, A]

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class TransformerFs2Ops[In, Out](transformer: Transformer[In, Out]) extends AnyVal

Since a Transformer is by design a stream transformation, we can naturally provide a conversion from Transformer to fs2.Pipe

Since a Transformer is by design a stream transformation, we can naturally provide a conversion from Transformer to fs2.Pipe

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Implicits

Implicits

final implicit def ParserFs2Ops[In, Out](parser: Parser[In, Out]): ParserFs2Ops[In, Out]

Since Parser is by design a stream consumer, we can provide the parseF helper which consumes a fs2.Stream in an effectful way. We can also provide the toPipe method, which transforms an input fs2.Stream to a new stream which emits exactly one value or raises an error.

Since Parser is by design a stream consumer, we can provide the parseF helper which consumes a fs2.Stream in an effectful way. We can also provide the toPipe method, which transforms an input fs2.Stream to a new stream which emits exactly one value or raises an error.

Attributes

final implicit def SourceFs2Ops[A](source: Source[A]): SourceFs2Ops[A]

Since Source is a synchronous-only encoding of the Resource pattern, it can be converted to a cats.effect.Resource by suspending its open and close operations in a Sync effect type F, yielding an Iterator[A] as its value.

Since Source is a synchronous-only encoding of the Resource pattern, it can be converted to a cats.effect.Resource by suspending its open and close operations in a Sync effect type F, yielding an Iterator[A] as its value.

This can be taken a step further by lifting that Resource to a fs2.Stream and wrapping the provided Iterator as a stream, to treat the whole Source[A] as a fs2.Stream[F, A]

Attributes

final implicit def TransformerFs2Ops[In, Out](transformer: Transformer[In, Out]): TransformerFs2Ops[In, Out]

Since a Transformer is by design a stream transformation, we can naturally provide a conversion from Transformer to fs2.Pipe

Since a Transformer is by design a stream transformation, we can naturally provide a conversion from Transformer to fs2.Pipe

Attributes

implicit def unconsableForFs2Chunk: Unconsable[Chunk]