What constitutes a fold for types other than list?

前端 未结 4 1855
遥遥无期
遥遥无期 2020-11-28 18:05

Consider a single-linked list. It looks something like

data List x = Node x (List x) | End

It is natural to define a folding function such

4条回答
  •  萌比男神i
    2020-11-28 18:36

    I would call this a fold, and declare Tree a Foldable. See the Foldable example in the GHC docs.

提交回复
热议问题