Skip to content

Add nubbed merge#43

Merged
garyb merged 4 commits into
purescript:compiler/0.12from
natefaubion:nubbed-merge
May 22, 2018
Merged

Add nubbed merge#43
garyb merged 4 commits into
purescript:compiler/0.12from
natefaubion:nubbed-merge

Conversation

@natefaubion
Copy link
Copy Markdown
Contributor

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.

@MonoidMusician
Copy link
Copy Markdown

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

@natefaubion
Copy link
Copy Markdown
Contributor Author

I've added disjointUnion.

@MonoidMusician
Copy link
Copy Markdown

Thanks! you win the naming game 🏆 😄

@garyb garyb merged commit 5e83b7d into purescript:compiler/0.12 May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants