applicatives.py
replace return NotImplementedError with raise NotImplementedError
return NotImplementedError
raise NotImplementedError
add Either applicative
Either
Add Alternative
Alternative
functors.py
add Bifunctor section
Bifunctor
restructure the notebook
replace f in the function signatures with g to indicate regular functions and distinguish from functors
f
g
move Maybe funtor to section More Functor instances
Maybe
More Functor instances
add Either functor
add unzip utility function for functors
unzip
the apply method of Maybe Applicative should return None when fg or fa is None
apply
None
fg
fa
add sequenceL as a classmethod for Applicative and add examples for Wrapper, Maybe, List
sequenceL
Applicative
Wrapper
List
add description for utility functions of Applicative
refine the implementation of IO Applicative
IO
reimplement get_chars with IO.sequenceL
get_chars
IO.sequenceL
add an example to show that ListMonoidal is equivalent to List Applicative
ListMonoidal
Migrate to python3.13
python3.13
Replace all occurrences of
class Functor(Generic[A])
with
class Functor[A]
for conciseness
Use fa in function signatures instead of a when fa is a Functor
a
0.1.0
06_applicatives.py
Use uppercased letters for Generic types, e.g. A = TypeVar("A")
Generic
A = TypeVar("A")
Refactor the Functor class, changing fmap and utility methods to classmethod
Functor
fmap
classmethod
For example:
@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
check_functor_law
Rename ListWrapper to List for simplicity
ListWrapper
Remove the Just class
Just
Rewrite proofs
05_functors
Thank Akshay and Haleshot for reviewing
05_functors.py