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

Accumulation of sums reverses element order #35

Open
andriusstank opened this issue Oct 29, 2023 · 0 comments
Open

Accumulation of sums reverses element order #35

andriusstank opened this issue Oct 29, 2023 · 0 comments

Comments

@andriusstank
Copy link

The type of accumulation operator taken by haccum (it's ... -> g x -> h x -> h x) suggests right fold will be performed, while in fact haccum performs left fold.

This mismatch is evident with hpartition function - element order gets reversed:

embedInt :: Int -> '[Int] :/ Identity
embedInt x  = EmbedAt membership (Identity x)

items :: ['[Int] :/ Identity]
items = embedInt <$> [1,2,3]

y :: '[Int] :& Compose [] Identity
y = hpartition id items

-- >>> y
-- Compose [Identity 3,Identity 2,Identity 1] <: nil
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