| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Stock.Enum
Description
Enum and Ix synthesizers. Enum is for enumerations (all-nullary
constructors); its toEnum range-checks like GHC. Ix covers both
enumerations (synthIx) and single-constructor products (synthIxProduct,
Cartesian range / mixed-radix index). (Bounded lives in Stock.Bounded.)
Synopsis
- synthEnum :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct])
- synthIx :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct])
- synthIxProduct :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct])
- zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]
- zipWith5q :: [Type] -> [CoreExpr] -> [Id] -> [Id] -> [Id] -> [(Type, CoreExpr, Id, Id, Id)]
Documentation
synthEnum :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct]) Source #
A constructor's fixity precedence (default 9), used for Show/Read of
infix constructors (showParen (d > prec), args at prec+1).
synthIx :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct]) Source #
Synthesize an Ix dictionary for an enumeration. rangeunsafeIndex
inRange work on constructor tags; indexrangeSizeunsafeRangeSize
come from the class defaults; the Ord superclass is synthesized too.
synthIxProduct :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct]) Source #
Synthesize Ix (Stock P) for a single-constructor PRODUCT (like GHC):
range is the Cartesian product of the per-field ranges (row-major nested
concatMap/map), unsafeIndex the mixed-radix index
(acc * unsafeRangeSize fj + unsafeIndex fj), inRange the conjunction of
per-field inRange. index/rangeSize/unsafeRangeSize come from the
class defaults; the Ord superclass is synthesized.