I'm reading the wikipedia article about catamorphisms and for the moment I was able to reproduce the Haskell examples in F# except for this part :
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
Is this possible to do in F#?
List.fold
) but not generically as in your quoted example. – ImpaleT f = f Bool
, wheref : *->*
. You can do that in Haskell or Scala, but I don't know if F# allows that. – Latona