cats.mtl
FunctorLayerFunctor is the capability to lift Functor homomorphisms in Inner (Inner ~> Inner) into homomorphisms in M (Inner ~> Inner).
FunctorLayerFunctor
Functor
Inner
Inner ~> Inner
M
FunctorLayerFunctor[M, Inner] has two external laws:
FunctorLayerFunctor[M, Inner]
def layerMapRespectsLayerImapK[A](ma: M[A])(forward: Inner ~> Inner, backward: Inner ~> Inner) = { layerImapK(ma)(forward, backward) <-> layerMapK(ma)(forward) } def layerMapRespectsLayer[A](in: Inner[A])(forward: Inner ~> Inner) = { layer(forward(in)) <-> layerMapK(layer(in))(forward) }
FunctorLayerFunctor[M, Inner] has one free law, that is, one law guaranteed by other laws and parametricity:
def layerMapRespectsId[A](in: M[A]) = { in <-> layerImapK(in)(FunctionK.id, FunctionK.id) } Justification: layerImapK(in)(FunctionK.id, FunctionK.id) <-> in [by layerMapRespectsLayerImapK[A]] layerMapK(in)(FunctionK.id) <-> layerImapK(FunctionK.id, FunctionK.id) [by layerImapRespectsId[A]]
FunctorLayerFunctor
is the capability to liftFunctor
homomorphisms inInner
(Inner ~> Inner
) into homomorphisms inM
(Inner ~> Inner
).FunctorLayerFunctor[M, Inner]
has two external laws:FunctorLayerFunctor[M, Inner]
has one free law, that is, one law guaranteed by other laws and parametricity: