Skip to content

Sets aren't comparable #310

@LiamGoodacre

Description

@LiamGoodacre

I was wanting a unionAll function:

unionAll : Set (Set comparable) -> Set comparable

I went to define it as such:

import Set as S

unionAll xs = S.foldl S.union S.empty xs

a = S.fromList [1, 2, 3]
b = S.fromList [3, 4, 5]
xs = S.fromList [a, b]

main = asText <| unionAll xs

Receiving the following compile error:

Type error on line 3:
Expecting something comparable such as an
Int, Float, Char, String, or a list or tuple of comparables.

        S.union

   Expected Type: S.Set comparable
     Actual Type: comparable

Compiled on share-elm with master/HEAD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions