Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created March 20, 2019 07:29
Show Gist options
  • Save monadplus/e68a1ee4afbda5d9fa7a22d3218cc67a to your computer and use it in GitHub Desktop.
Save monadplus/e68a1ee4afbda5d9fa7a22d3218cc67a to your computer and use it in GitHub Desktop.
Kind projector function syntax
// underlying: Ref[F, A]
// trans: F ~> G
// underlying.access: F[(A, A => F[Boolean])]
// Mapping from F[(A, A => F[Boolean])] to G[(A, A => G[Boolean])]
override def access: G[(A, A => G[Boolean])] =
trans(F.compose[(A, ?)].compose[A => ?].map(underlying.access)(trans(_)))
// Step by Step
// Functor[F[_]] // compose[(A, ?)]
// -> Functor[F[(A, _)]] // compose[A => ?]
// -> Functor[F[(A, A => _)]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment