| ID | 359fb8ce-cfe0-4fda-b09f-223ec19d91d0 |
|---|---|
| DeertopiaVisibility | public |
Constant functor (category theory)
For categories and , and -object , there is the constant functor , defined by
\begin{gather*} \text{Const}_R \; (A \xrightarrow{f} B) = R \xrightarrow{\id_R} R. \end{gather*} ParseError: Function "\id" is not trusted at position 74: β¦R \xrightarrow{\Μ²iΜ²dΜ²_R} R. \end{gatβ¦The constant functor sees application in Haskell, especially in particularly type-tricky projects such as lens, where the constant functor powers getters.
newtype Const r a = MkConst r
instance Functor (Const r) where
fmap f (MkConst x) = MkConst x