Skip to content

Semigroup.py fails when trying to join array and tuple #2

Description

@mikesol

Hi!

I've noticed that sometimes, the function concatArray in Semigroup.py receives a list and a tuple to concat, which results in the following error:

TypeError: can only concatenate tuple (not "list") to tuple

In my local copy of the library, I've changed it to this just to get things working:

def concatArray(xs):
    def _1(ys):
        foo = tuple(xs)
        bar = tuple(ys)
        return bar if not foo else foo if not bar else foo + bar
    return _1

But that feels a bit off.

Is there a general policy for tuples vs lists in python-land? For example, in Data.Functor in the prelude, I see that tuple is used, but in Data.Array I see that list is used.

If tuples and lists can be used interchangeably, then I'd make sure that the concat operator is changed to something like the code above.

Activity

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

Metadata

Metadata

Assignees

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