dry-python / dry-python/classes

Typeclasses with several methods

オープン
#83 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement help wanted
主要言語
Python
スター
730
フォーク
30
PR マージ指標
30日以内にマージされた PR はありません

説明

There's a common use-case when we need to create a type-class with several methods. Like:

```python
class Functor(Protocol[T]):
def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
...

@classmethod
def from_value(cls, inner_value: V) -> Functor[V]:
...
```

Currently, there's no way we can do that.

I propose something like this:

```python
@typeclass
class Functor(Protocol[T]):
def map(self, function: Callable[[T], Functor[V]]) -> Functor[V]:
...

@classmethod
def from_value(cls, inner_value: V) -> Functor[V]:
...

```

I am not sure how to bound it to the actual implementation.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。