category-theory-presentation/categories/30_How/200_Monads/030_Natural_Transformation_Examples_3_4.md
2013-02-28 16:49:12 +01:00

641 B

Natural Transformation Examples (3/4)

toMaybe :: [a] -> Maybe a
toMaybe [] = Nothing
toMaybe (x:xs) = Just x

toMaybe is a natural transformation. It is also a morphism from [] to Maybe in the Category of \(\Hask\) endofunctors.

natural transformation commutative diagram
natural transformation commutative diagram