Free monad
Initial algebraの族からのadjunction
- category:
- endofunctor:
- forgetful functor:
について、initial algebraの族:
が存在するならば、Initial algebras with parameters - PSより、これをnaturalにするfunctor:
を作ることが出来る。いま、
とすると
は、initial morphismの族となるので
逆に、unit-adjunction:
が存在すれば、
は、initial algebraの族となる。
Free monad
Haskellにて
data Free f a = Pure a | Free (f (Free f a))
Initial algebraからのcatamorphism*2は、
cata :: Functor f => (a -> b) -> (f b -> b) -> Free f a -> b cata h phi (Pure a) = h a cata h phi (Free m) = phi (fmap (cata h phi) m)
で、これから全て導かれる(はず)。
Adjunctionのunitは、constructorPure
で、counitはiter
になる(と思う)。
参考文献
- Category Theory (Oxford Logic Guides) Proposition 10.14
- Kan.pdf
- Free monads in category theory (part 1)
- Control-Monad-Free
*1:Free monadの数学的定義はややこしい模様: Category of monads - PS
*2:mediatorのこと