purescript / purescript-typelevel-prelude

Types and kinds for basic type-level programming
BSD 3-Clause "New" or "Revised" License
63 stars 21 forks source link

Add SubRow class #21

Closed coot closed 7 years ago

coot commented 7 years ago

I need SubRow class for: https://github.com/purescript/purescript-record/issues/5

paf31 commented 7 years ago

Why not use Union directly? This class doesn't add any new laws or behavior.

coot commented 7 years ago

good point, indeed.

matthewleon commented 6 years ago

I feel like this has ergonomic value to library users: it requires one less variable definition in your forall, and it somewhat clarifies your intentions. One place I would find this useful, for example, is in replacing use of Options from purescript-options with a simple SubRow r OptionsRow.

It's a bit more readable than Union r r' OptionsRow.

matthewleon commented 6 years ago

Here is an example of what I'm going for. I really think SubRow makes this much more readable: http://try.purescript.org/?session=062a58b9-1bb1-b95d-2feb-b40bf47814b1&backend=core&gist=804bad033e33970e6ba10f84b669107e