PolyFunction

trait PolyFunction[F[_], G[_]]

Natural transformation, turning a polymorphic type into another, whilst keeping the type parameter intact.

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def apply[A](fa: F[A]): G[A]

Concrete methods

def unsafeCache(allPossibleInputs: Vector[Existential[F]]): PolyFunction[F, G]

Pre-computes the polyfunction by applying it on a vector of possible inputs.

Pre-computes the polyfunction by applying it on a vector of possible inputs.

Unsafe because calling the resulting polyfunction with an input that wasn't cached will result in an exception.

See https://stackoverflow.com/questions/67750145/how-to-implement-types-like-mapk-in-scala-3-dotty

def unsafeMemoise: PolyFunction[[a] =>> Static[F[a]], G]

Creates a memoised version of this function that will only accept values proven to be static values as inputs.

Creates a memoised version of this function that will only accept values proven to be static values as inputs.

Unsafe because it creates mutable state, which is a non-referentially-transparent action (aka a side-effect).