Spaces:
Running
Changelog of the functional-programming course
2025-04-16
applicatives.py
replace
return NotImplementedError
withraise NotImplementedError
add
Either
applicativeAdd
Alternative
2025-04-11
functors.py
add
Bifunctor
sectionreplace
return NotImplementedError
withraise NotImplementedError
2025-04-08
functors.py
restructure the notebook
replace
f
in the function signatures withg
to indicate regular functions and distinguish from functorsmove
Maybe
funtor to sectionMore Functor instances
add
Either
functoradd
unzip
utility function for functors
2025-04-07
applicatives.py
the
apply
method ofMaybe
Applicative should returnNone
whenfg
orfa
isNone
add
sequenceL
as a classmethod forApplicative
and add examples forWrapper
,Maybe
,List
add description for utility functions of
Applicative
refine the implementation of
IO
Applicativereimplement
get_chars
withIO.sequenceL
add an example to show that
ListMonoidal
is equivalent toList
Applicative
2025-04-06
applicatives.py
- remove
sequenceL
fromApplicative
because it should be a classmethod but can't be generically implemented
2025-04-02
functors.py
Migrate to
python3.13
Replace all occurrences of
class Functor(Generic[A])
with
class Functor[A]
for conciseness
Use
fa
in function signatures instead ofa
whenfa
is a Functor
applicatives.py
0.1.0
version of notebook06_applicatives.py
2025-03-16
functors.py
Use uppercased letters for
Generic
types, e.g.A = TypeVar("A")
Refactor the
Functor
class, changingfmap
and utility methods toclassmethod
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 fromFunctor
class to a standard functionRename
ListWrapper
toList
for simplicityRemove the
Just
classRewrite proofs
2025-03-13
functors.py
0.1.0
version of notebook05_functors
Thank Akshay and Haleshot for reviewing
2025-03-11
functors.py
- Demo version of notebook
05_functors.py