Skip to content

mappend nor <> don't override #716

Open
@yaitskov

Description

@yaitskov

Hi,

I noticed inconsistency with Monoid and Semigroup implementations for List.
Map implementations keep first value for duplicated key.

M.singleton 1 1  `mappend`  M.singleton 1 2
fromList [(1,1)]
λ M.singleton 1 1  <>  M.singleton 1 2
fromList [(1,1)]

but if map is constructed from combined equivalent lists then duplicated keys are overriden

M.fromList $ M.toList (M.singleton 1 1)  <>  M.toList (M.singleton 1 2)
fromList [(1,2)]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions