Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip copyRecord for buildFromScratch in Builder #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ New features:
Bugfixes:

Other improvements:
- Skipped needing to copy initiial record for `buildFromScratch`. (#80)

## [v3.0.0](https://github.com/purescript/purescript-record/releases/tag/v3.0.0) - 2021-02-26

Expand Down
3 changes: 1 addition & 2 deletions src/Record/Builder.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module Record.Builder

import Prelude hiding (flip)

import Data.Function (flip) as Function
import Data.Function.Uncurried (runFn2)
import Data.Symbol (class IsSymbol, reflectSymbol)
import Prim.Row as Row
Expand Down Expand Up @@ -50,7 +49,7 @@ build (Builder b) r1 = b (copyRecord r1)

-- | Build a record from scratch.
buildFromScratch :: forall r. Builder (Record ()) (Record r) -> Record r
buildFromScratch = Function.flip build {}
buildFromScratch (Builder b) = b {}

-- | Flip a function of one argument returning a builder.
flip :: forall r1 r2 r3. (Record r1 -> Builder (Record r2) (Record r3)) -> Record r2 -> Builder (Record r1) (Record r3)
Expand Down