Skip to content

generalize type of Data.Set.unions (from List to Foldable)? #520

Closed
@jwaldmann

Description

@jwaldmann

We have unions :: Ord a => [Set a] -> Set a. Haddocks say that unions == foldl union empty
so I'd expect it to have type (Foldable t, Ord a) => t (S.Set a) -> S.Set a, the type that would be inferred when I literally use the given definition.

Yes, I know that it's S.foldl, not Data.Foldable.foldl. Why? If there is a reason, then it would be good to have it documented (visibly). But instance Foldable Set where foldl = foldl, so they are equivalent already? The actual source has unions = foldlStrict union empty, so the docs are not telling the full truth.

There is a comment at https://hackage.haskell.org/package/containers-0.5.11.0/docs/src/Utils.Containers.Internal.StrictFold.html#foldlStrict but this is hard to find? (source is there but its rendered haddock is not, since this is from other-modules)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions