Skip to content

Applicative

Applicative

Bases: Functor[F, A], Protocol

An applicative is a functor that contains a function which the applicative applies to arguments.

The generic type variable F is the applicative type. The generic type variable A is the type of the value contained in the applicative type.

Source code in funclift/applicative.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class Applicative(Functor[F, A], Protocol):
    """
    An applicative is a [functor][funclift.functor.Functor] that contains a
    function which the applicative applies to arguments.

    The generic type variable F is the applicative type. The generic type
    variable A is the type of the value contained in the applicative type.
    """

    @staticmethod
    def pure(a: B) -> Applicative[F, B]:
        """_summary_

        Args:
            a (B): _description_

        Returns:
            Applicative[F, B]: _description_
        """
        ...

    def ap(self: Applicative[F, Callable[[C], E]],
           a: Applicative[F, C]) -> Applicative[F, E]:
        """_summary_

        Args:
            self (Applicative[F, Callable[[C], E]]): _description_
            a (Applicative[F, C]): _description_

        Returns:
            Applicative[F, E]: _description_
        """
        ...

    @abstractmethod
    def fmap(self, f: Callable[[A], B]) -> Applicative[F, B]:
        ...

ap(a)

summary

Parameters:

Name Type Description Default
self Applicative[F, Callable[[C], E]]

description

required
a Applicative[F, C]

description

required

Returns:

Type Description
Applicative[F, E]

Applicative[F, E]: description

Source code in funclift/applicative.py
37
38
39
40
41
42
43
44
45
46
47
48
def ap(self: Applicative[F, Callable[[C], E]],
       a: Applicative[F, C]) -> Applicative[F, E]:
    """_summary_

    Args:
        self (Applicative[F, Callable[[C], E]]): _description_
        a (Applicative[F, C]): _description_

    Returns:
        Applicative[F, E]: _description_
    """
    ...

pure(a) staticmethod

summary

Parameters:

Name Type Description Default
a B

description

required

Returns:

Type Description
Applicative[F, B]

Applicative[F, B]: description

Source code in funclift/applicative.py
25
26
27
28
29
30
31
32
33
34
35
@staticmethod
def pure(a: B) -> Applicative[F, B]:
    """_summary_

    Args:
        a (B): _description_

    Returns:
        Applicative[F, B]: _description_
    """
    ...