[RFC] Infinite lists

Thanks, that is good to know.

I guess I have the perspective that folds are just catamorphisms. So I find foldr very natural for lists (not for other data structures). Other functions like foldr1 and foldl are just special cases of foldr.

Now that I’m thinking more about Foldable, I’m also missing functions like foldMap :: Semigroup m => (a -> m) -> Infinite a -> m and fold :: Semigroup m => Infinite m -> m. I guess an argument against adding those is that there are not that many semigroups for which these will terminate.

I thought about cata :: (a -> b -> b) -> Infinite a -> b, but it might be too scary for uninitiated.

The package has been released: infinite-list: Infinite lists