2018-10-12 18:09:16 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Callable, TypeVar
|
|
|
|
|
|
|
|
from .functor import Functor
|
|
|
|
|
|
|
|
T = TypeVar("T")
|
|
|
|
S = TypeVar("S")
|
|
|
|
|
|
|
|
|
|
|
|
class Applicative(Functor[T]):
|
|
|
|
@classmethod
|
2018-10-12 18:24:03 +00:00
|
|
|
def pure(cls, value: T) -> Applicative[T]: # pragma: no cover
|
2018-10-12 18:09:16 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
# FIXME: Functor type set to Any, as the proper value
|
|
|
|
# (Functor[Callable[[T], S]]) is reported as incompatible with subclass
|
|
|
|
# implementations due to a flaw in mypy:
|
|
|
|
# https://github.com/python/mypy/issues/1317
|
2018-10-12 18:24:03 +00:00
|
|
|
def apply(self, functor: Any) -> Functor[S]: # pragma: no cover
|
2018-10-12 18:09:16 +00:00
|
|
|
raise NotImplementedError
|