Skip to content

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

@mikesol

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.

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