Closed natefaubion closed 6 years ago
Thanks Nate, looks good to me! Do you want to add the version of merge
that ensures they are disjoint (and has better inference)?
-- | Merge two disjoint records (containing different labels). This helps infer
-- | types for the input records based on the output records, as `merge` only
-- | will infer the output based upon the input.
-- |
-- | For example, hole `?help` is inferred to have type ``{ b :: Int }` here:
-- |
-- | ```purescript
-- | merge' { a: 5 } ?help :: { a :: Int, b :: Int }
-- | ```
merge'
:: forall r1 r2 r3
. Union r1 r2 r3
=> Nub r3 r3
=> Record r1
-> Record r2
-> Record r3
merge' l r = merge l r
I've added disjointUnion
.
Thanks! you win the naming game :trophy: :smile:
This does what #40 does but with new compiler stuff. I did not make the change for a mutating Builder merge, as I think that might warrant some more discussion.