Functional Abstractions: Functor to Monad
The type-class abstractions of functional programming, from map and flatMap through functor, applicative, traversable and monad to monoids, type classes and category theory. Part of Functional programming.
In Home
In Functional Programming
In Abstractions
The type-class abstractions of functional programming, from map and flatMap through functor, applicative, traversable and monad to monoids, type classes and category theory. Part of Functional programming.
Applying functions that sit inside a functor with pure and <*>, applicative style for independent computations, how it differs from a monad, the laws, and the Maybe, list and ZipList instances.
Why category theory is worth knowing for a programmer, how its standard constructions map onto types, functors and currying, purity and denotational semantics, natural transformations, and resources for learning it.
A functor as a computational context: the Functor class and fmap, kinds and type constructors, lifting, the functor laws, and instances including functions.
Monads as a way to glue functions into sequential computations, map, flatMap and for expressions in Scala, and the Option, Writer, State, Reader and IO monads, including what IO does and doesn't make pure.
Associative combination and the identity element: definitions, laws, examples and uses of semigroups and monoids, and why the identity matters.
traverse, sequenceA and traverse_, how the chosen applicative decides between short-circuiting, IO effects, parallelism and state, writing instances, the laws, and the essence of the iterator pattern.
Kinds of polymorphism and parametricity, type classes and their Haskell and Scala encodings compared with Java interfaces, higher-kinded types, GADTs, type-level programming with singletons, and tagless final.
What map preserves in a structure such as Option, the identity and composition laws behind it, and when the next step needs flatMap instead, with Scala examples.
Changes apply to the theme selected here. Switching it also switches the site theme.