我正在阅读关于 catamorphisms 的维基百科文章,目前我能够在 F# 中重现 Haskell 示例,除了这一部分:
type Algebra f a = f a -> a -- the generic f-algebras
newtype Fix f = Iso { invIso :: f (Fix f) } -- gives us the initial algebra for the functor f
cata :: Functor f => Algebra f a -> (Fix f -> a) -- catamorphism from Fix f to a
cata alg = alg . fmap (cata alg) . invIso -- note that invIso and alg map in opposite directions
这可以在 F# 中完成吗?