Compose

Composition of functors.
Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.

Examples

>>> fmap (subtract 1) (Compose (Just [1, 2, 3]))
Compose (Just [0,1,2])
>>> Compose (Just [1, 2, 3]) <> Compose Nothing
Compose (Just [1,2,3])
>>> Compose (Just [(++ "World"), (++ "Haskell")]) <*> Compose (Just ["Hello, "])
Compose (Just ["Hello, World","Hello, Haskell"])
Composition of contravariant functors.
Composition of two contravariant functors
Composition of monad transformers. A higher-order version of Data.Functor.Compose.
Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
Composition of constraints. Note that the result of the composition must be a constraint, and therefore, in Compose f g, the kind of f is k -> Constraint. The kind of g, however, is l -> k and can thus be a normal type constructor. A typical use case is in connection with All on an NP or an NS. For example, in order to denote that all elements on an NP f xs satisfy Show, we can say All (Compose Show f) xs.
TextShow instance for Compose. Since: 3
Composition of constraints. Note that the result of the composition must be a constraint, and therefore, in Compose f g, the kind of f is k -> Constraint. The kind of g, however, is l -> k and can thus be a normal type constructor. A typical use case is in connection with All on an NP or an NS. For example, in order to denote that all elements on an NP f xs satisfy Show, we can say All (Compose Show f) xs.
Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.
Utilities for working with Data.Functor.Compose. NB: This module contains an orphan instance. It will be included in GHC 8.10, see https://gitlab.haskell.org/ghc/ghc/merge_requests/273 and also https:/github.comhaskell-compatbase-orphansissues/49.
Equivalent of Compose for rank 2 data types