| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Stock.Functor
Description
Functor / Contravariant and Foldable synthesizers over Stock1 (the variance walk).
Synopsis
- synthFunctor :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct]))
- synthContravariant :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct]))
- synthMap1 :: Variance -> GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct]))
- synthFoldable :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct]))
Documentation
synthFunctor :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct])) Source #
synthContravariant :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct])) Source #
Synthesize Contravariant (Stock1 F) — the contravariant instance of
synthMap1.
synthMap1 :: Variance -> GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct])) Source #
The shared engine for the two single-parameter map-like classes over
Stock1 F. fmap and contramap differ only in: the order of the two type
variables in the method (forall a b vs forall a' a), the direction of the
supplied function (a -> b vs a' -> a), and which varMap base case it
feeds — so both are this one definition. The non-overridden method ((<$)
resp. (>$), both at class-method index 1) comes from the class default; the
field walk is the full variance recursion in varMap.
synthFoldable :: GenEnv -> Class -> CtLoc -> Type -> Type -> TcPluginM (Maybe (EvTerm, [Ct])) Source #
Synthesize Foldable (Stock1 F). foldMap maps the parameter fields and
folds H a fields with their own foldMap, combining contributions with
(<>) (constant fields contribute nothing); all other Foldable methods
come from the class defaults. Nothing for unsupported field shapes.