Skip to content

Instantly share code, notes, and snippets.

@sellout
Created December 11, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sellout/4830409b4e9a2a41e9d7b940b64df373 to your computer and use it in GitHub Desktop.
Save sellout/4830409b4e9a2a41e9d7b940b64df373 to your computer and use it in GitHub Desktop.
trait Ops[T, F[_]] {
// currently
object transCata {
def apply[U] = new PartiallyApplied[U] // PartiallyApplied
final class PartiallyApplied[U] {
def apply[G[_]: Functor] // unnecessary type param, and seductive constraint syntax
(f: F[U] => G[U])
(implicit U: Corecursive.Aux[U, G], BF: Functor[F]) // Aux
: U =
typeClassInstance.transCata(self)(f)
}
}
// with multiple implicit lists eliminates all of ↑
def transCata[U]
(implicit U: Corecursive[U])
(implicit F: Functor[F], B: Functor[U.Base])
(f: F[U] => U.Base[U])
: U =
typeClassInstance.transCata(self)(f)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment