Reputation:
How to modify just one field of a record without rewriting it completely?
Here I learned a helpful Haskell syntax to modify an element of a record without rewriting it completely:
oldrecord { somefield = newvalue }
Is something similar possible with tuples?
type ABigTuple = (Int, Int, Double, Int, String)
aBigTuple :: ABigTuple
aBigTuple = (5, 6, 3.2, 10, "asdf")
anotherBigTuple = -- replace the 3rd elt of the prev tuple with 5.5 i/o 3.2
Is this possible in a manner similar to records, or do I have to rewrite the whole tuple?
Upvotes: 2
Views: 245