The base value can have any type
a. The recursive result has that same type, so the step must accept and return a. Thus the most general polymorphic type signature of the natural-number fold isfoldNat :: (a -> a) -> a -> Natural -> aIn mathematical type notation, . No equality, ordering or numeric constraint is needed: the natural-number fold manipulates constructors, rather than performing arithmetic on the result.
Articles by others on the same topic
There are currently no matching articles.