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
The type of accumulation operator taken by
haccum
(it's... -> g x -> h x -> h x
) suggests right fold will be performed, while in facthaccum
performs left fold.This mismatch is evident with
hpartition
function - element order gets reversed: