In actual programming, you can always define `fold...
# arrow
c
In actual programming, you can always define
fold
on any Functor, but not all operations can be called on it (there needs to be a default value). So it sounds like
fold
is defined neither on a category nor on a morphism but on the pair of both of them?
r
Fold shows up in Algebras that are higher kinded frequently in List etc, but you can also see it in types like String -> Array<Char>
c
Wouldn't that be some kind of
flatMap
or something of the sort? It looks like
(Functor f, Functor g) => f a -> g a
(sorry if the notation is wrong)
r
that is a natural transformation
F<A> -> G<A>
in Arrow FunctionK
In Kotlin we have to make the distinctions between higher order (more than one type arg)
but that usually is implemented with a fold
because you go from one ADT or Algebra to another.
When your encoding is based on ADT that is frequently just folding the ADT and contemplating all cases