purescript/purescript-lists

Data.List.Lazy has several stack-unsafe methods

sammthomson opened this issue · 0 comments

Data.List.Lazy has several stack-unsafe methods: length, reverse, foldr, foldl, foldMap, and traverse. They have simple fixes and I have an incoming PR.

foldr and traverse are things where it seems like a lazy version would be useful. But as far as I can tell it's impossible to implement them lazily without changing their types in purescript-foldable-traversable. E.g., a lazy foldr might have a type like

foldrLazy :: forall a b. Lazy b => (a -> b -> b) -> b -> f a -> b

Since they can't be lazy given their current types, they might as well be stack-safe.