Skip to content

Enable Supports[] to refer to multiple typeclasses #206

Closed
@eganjs

Description

@eganjs
class Foo:
    def __call__(self, instance) -> A:
        ...

foo = typeclass(Foo)

...

class Bar:
    def __call__(self, instance) -> B:
        ...

bar = typeclass(Bar)

...

def fn(instance: Supports[Foo, Bar]) -> C:
    ...

This is similar to #83 and python/typing#213, but offers the advantages of composability and conciseness.

I'd be willing to have a go at implementing this but I'm not very familiar with mypy plugins (where I suspect most of the work would be required).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions