This is a quick post about the new RowLacks type class that was added to purescript-typelevel-prelude. This can be used to require that a row does not contain a specific key. The type class has the following signature:

class RowLacks ( key :: Symbol ) ( row :: # Type )

There is a single instance defined for this type class. Using RowCons , Union , and instance resolution in interesting ways such that an instance isn’t found if row contains the label key .

So the following will compile:

eg0 :: Unit eg0 = unit :: RowLacks "foo" ( bar :: Unit ) => Unit

But this program fails because row contains a label key :

eg1 :: Unit eg1 = unit :: RowLacks "foo" ( foo :: Unit , bar :: Unit ) => Unit -- compile error: -- -- [1/1 NoInstanceFound] -- -- eg1 = unit :: RowLacks "foo" (foo :: Unit, bar :: Unit) => Unit -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -- -- No type class instance was found for -- -- Type.Row.RowLacking Entry "foo" Unit (foo :: Unit, bar :: Unit)

Implementation

Here’s the full implementation: