Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird Foldable.toList behaviour #24

Open
noinia opened this issue Nov 7, 2021 · 0 comments
Open

Weird Foldable.toList behaviour #24

noinia opened this issue Nov 7, 2021 · 0 comments

Comments

@noinia
Copy link

noinia commented Nov 7, 2021

The current Foldable instance leads to somewhat weird behaviour in which the elements are produced in a weird order, as evidenced by the following example:

>>> import qualified Data.Foldable as F
>>> import qualified Data.CircularList as C
>>> mapM_ print $ fmap (\cl -> (cl, F.toList cl, C.toList cl)) $ C.allRotations $ C.fromList [0,8,5,4,1]
(fromList [0,8,5,4,1],[0,8,5,1,4],[0,8,5,4,1])
(fromList [8,5,4,1,0],[8,5,0,1,4],[8,5,4,1,0])
(fromList [5,4,1,0,8],[5,8,0,1,4],[5,4,1,0,8])
(fromList [1,0,8,5,4],[1,0,8,5,4],[1,0,8,5,4])
(fromList [4,1,0,8,5],[4,1,0,8,5],[4,1,0,8,5])

I would probably expect Foldable's toList to behave the same way as C.toList

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant