Module

Record.ExtraSrghma.CompareRecord

Package
purescript-record-extra-srghma
Repository
srghma/purescript-record-extra-srghma

#OrdRecord Source

class OrdRecord :: forall k. k -> Row Type -> Constraintclass OrdRecord rl row | rl -> row where

Type class to compare two records field by field, following a known ordering of keys (a RowList).

Members

Instances

  • (IsSymbol name, Ord ty, Cons name ty trash row, OrdRecord tail row) => OrdRecord (Cons name ty tail) row

    Compare two records by the current head field, and recurse on the tail if equal.

  • OrdRecord Nil row

    Base case: comparing empty RowList always returns EQ.

#compareRecord Source

compareRecord :: forall row rl. RowToList row rl => OrdRecord rl row => Record row -> Record row -> Ordering

Public interface for comparing two records deterministically by their keys. You must provide a type with an instance of RL.RowToList to determine key ordering.