Skip to content

Accumulation of sums reverses element order #35

Description

@andriusstank

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions