File size: 1,436 Bytes
7339b50
 
3c4c5bc
 
 
 
 
 
 
7139673
 
3c4c5bc
 
 
7139673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7339b50
 
 
6b8214a
 
 
 
db2b2a2
 
d417768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Changelog of the functional-programming course

## 2025-04-08

**functors.py**

* restructure the notebook
* replace `f` in the function signatures with `g` to indicate regular functions and distinguish from functors

## 2025-04-02

**functors.py**

+ Migrate to `python3.13`

    + Replace all occurrences of 

        ```python
        class Functor(Generic[A])
        ```

        with

        ```python
        class Functor[A]
        ```

        for conciseness

+ Use `fa` in function signatures instead of `a` when `fa` is a *Functor*

## 2025-03-11

* Demo version of notebook `05_functors.py`

## 2025-03-13

* `0.1.0` version of notebook `05_functors`

Thank [Akshay](https://github.com/akshayka) and [Haleshot](https://github.com/Haleshot) for reviewing

## 2025-03-16

+ Use uppercased letters for `Generic` types, e.g. `A = TypeVar("A")`
+ Refactor the `Functor` class, changing `fmap` and utility methods to `classmethod`

    For example:

    ```python
    @dataclass
    class Wrapper(Functor, Generic[A]):
        value: A

        @classmethod
        def fmap(cls, f: Callable[[A], B], a: "Wrapper[A]") -> "Wrapper[B]":
            return Wrapper(f(a.value))

    >>> Wrapper.fmap(lambda x: x + 1, wrapper)
    Wrapper(value=2)
    ```

+ Move the `check_functor_law` method from `Functor` class to a standard function
- Rename `ListWrapper` to `List` for simplicity
- Remove the `Just` class
+ Rewrite proofs