purescript/purescript-foldable-traversable

Unexpected scanr behavior

Closed this issue · 2 comments

In Haskell, scanr gives me the following:

Prelude Data.List> scanr (:) [] [1,2,3]
[[1,2,3],[2,3],[3],[]]

In Purescript, I get essentially the same output save for the missing empty list at the end.

> scanr (:) Nil [1,2,3]
[(1 : 2 : 3 : Nil),(2 : 3 : Nil),(3 : Nil)]

Is this on purpuose?

garyb commented

It's a consequence of scanr being implemented for Traversable in general, I think. The converse of #23.

I see. Thanks for the quick response.