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

Stock.Ord

Description

Ord synthesizer: tag order between constructors, lexicographic within.

Synopsis

Documentation

buildRel :: Class -> Class -> CtLoc -> Type -> Type -> Coercion -> [(DataCon, [Coercion])] -> Bool -> Bool -> TcPluginM (CoreExpr, [Ct]) Source #

A direct relational op a -> b -> Bool, matching GHC's derived </<=/>/>= for small types (it does NOT build an Ordering): different constructors compare by tag, equal constructors lexicographically x1 `fop` y1 || (x1 == y1 && rest). asc = ascending (</<=); refl = reflexive (<=/>=, so the final field and the nullary case include equality). The non-final fields use the strict op (</>) + ==; the final field uses the actual op.

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

Synthesize a structural Eq (Stock Inner) dictionary for any single-level algebraic Inner. Two values are equal iff they share a constructor and all corresponding fields are equal; field equality uses each field type's own Eq dictionary, requested as a fresh wanted constraint. | Bridge the internal Repr EDSL to the public Datatype view handed to SDK derivers.