stock-0.1.0.0: Stock-style deriving via coercion, with no Generic
Safe HaskellNone
LanguageGHC2021

Stock.Eq

Description

Eq synthesizer: two values are equal iff same constructor and all fields equal.

Synopsis

Documentation

synthEq :: Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> TcPluginM (EvTerm, [Ct]) Source #

Pointwise Semigroup for a single-constructor product: C x.. <> C y.. = C (x <> y).., each field combined with its own (<>) (a wanted). Same result as Generically, synthesized statically (a "faster Generically"). sconcat/stimes come from the class defaults.

conj :: CtLoc -> [(Id, Id, Coercion)] -> TcPluginM (CoreExpr, [Ct]) Source #

Conjoin per-field equalities — and [x0 == y0, x1 == y1, …] — via andE (the short-circuiting && chain). Each field's Eq dictionary is a wanted. Each triple is (x, y, fieldCo); the field is compared at its modifier type (coercionRKind fieldCo, the real type when Refl), the bound values coerced.