Comparing revisions for page Functors and friends
Back to history list== Headline == Lecture "Functors and friends" as part of [[Course:Lambdas in Koblenz]] == Description == List processing with [[map function|maps]] and [[fold function|folds]] is generalized to designated classes of types. In particular, we look at data types that can be thought of as modeling containers, and we treat them in a way similar to lists. This is possible, for example, for [[maybe type]]s and [[rose tree]]s. To this end, we leverage the notions of [[functor]] and [[foldable type]]. The corresponding type classes rely on [[higher-kinded polymorphism]]. We exercise maps and folds also in a non-trivial example of [[bidirectional transformation]]. In passing, we also engage in the more general notion of [[applicative functor]]s and the yet more general notion of [[monad]]s. Applicative functors allow for functorial computations to be sequenced (unlike plain functors), but don't allow using results from prior computations in the definition of subsequent ones (unlike monads). == Concepts == * Basic concepts (They are captured as type classes.) ** [[Functor]] ** [[Foldable type|Fold]] * Data types used for illustration ** [[Rose tree]] ** [[Maybe type]] * Other concepts at play ** [[Higher-kinded polymorphism]] ** [[Bidirectional transformation]] * Advanced concepts (They are captued as type classes, too.) ** [[Applicative functor]] ** [[Monad]] *** Specific monads **** The [[State monad]] **** The [[Maybe monad]] **** The [[Writer monad]] == Languages == * [[Language:Haskell]] == Features == * [[Feature:Total]] * [[Feature:Cut]] == Contributions == * [[Contribution:haskellTree]]: Bidirectional transformations * [[Contribution:haskellLogging]]: Logging changes * [[Contribution:haskellWriter]]: Logging changes monadically == Metadata == * [[memberOf::Course:Lambdas in Koblenz]] * [[dependsOn::Script:Type-class_polymorphism]]