Reading through this classic paper, I'm stuck on paramorphisms. Unfortunately the section is quite thin, and the Wikipedia page doesn't say anything.

My Haskell translation is:

para :: (a -> [a] -> b -> b) -> b -> [a] -> b
para f base = h
  where
    h []       =   base
    h (x:xs)   =   f x xs (h xs)

But I don't grok that -- I don't have any intuition for the type signature or the desired result.

What's a paramorphism, and what are some useful examples in action?


Yes, I've seen these questions, but they don't cover paramorphisms directly and only point to resources that may be helpful as references, but not as learning materials.

Edit
Report