Builder
matthewleon opened this issue · 3 comments
matthewleon commented
Would there be any interest in a Builder API?
michaelficarra commented
Go on...
matthewleon commented
Like this: https://pursuit.purescript.org/packages/purescript-record/0.2.6/docs/Data.Record.Builder
Or Java's StringBuilder.
You lazily accumulate mutations (concatenations, to start) to apply to a String inside of a smart-constructed StringBuilder type. Then you apply your build at the end, which applies the mutations serially to a copy of whatever base String you have (often the empty string). It allows you to do ST-like things with a more user-friendly API.
matthewleon commented
It's probably niche enough to deserve a separate lib rather than living in here. Feel free to reopen if you disagree.