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

RowList operations #15

Closed LiamGoodacre closed 6 years ago

LiamGoodacre commented 7 years ago

Building up a collection of RowList operations. PR for discussion.

MonoidMusician commented 7 years ago

Do you want to add a UnionNub kind of thing for properly typing merge? (as in RowUnion.purs, which should be left-biased unique but only has a Union constraint which creates duplicates)

Here's a naïve implementation (left-biased):

class UnionNub
  (a :: # Type)
  (b :: # Type)
  (c :: # Type)
  | -> a b c
instance unionNub ::
  ( Union a b r
  , RowToList r rl
  , ListToRow rl r
  , RowListNub rl cl
  , ListToRow cl c
  ) => UnionNub a b c

I could probably draft up intersection and difference too.

justinwoo commented 7 years ago

Could this go in sometime so I can depend on it? 😄 I need to use the RowAppend class the most

paf31 commented 7 years ago

I'm happy to merge this whenever @LiamGoodacre says it's good to go.

LiamGoodacre commented 6 years ago

Sorry, I completely forgot about this.

LiamGoodacre commented 6 years ago

I'll merge once Travis is happy.

LiamGoodacre commented 6 years ago

@paf31 do you want to make a v2.4.1 for this?