purescript / purescript-record

Functions for working with records and polymorphic labels
BSD 3-Clause "New" or "Revised" License
70 stars 31 forks source link

Add roles declarations to allow safe coercions #65

Closed kl0tl closed 3 years ago

kl0tl commented 4 years ago

This allows terms of type STRecord r a to be coerced to type STRecord r b when Coercible a b holds, hence allowing the zero cost coerce instead of map wrap and map unwrap to introduce and eliminate newtypes under ST records for instance.

I couldn’t think of a case where a phantom roled region is an issue but in doubt I preferred to keep it nominal.

JordanMartinez commented 3 years ago

Included in #66