Friday, 27 September 2013

Create new record with change in one value

Create new record with change in one value

Suppose my record (with large number of fields) is defined like this:
data Sample_Record = Sample_Record { record_field1 :: Int,
record_field2 :: Int,
record_field3 :: Float
}
a = Sample_Record { record_field1 = 4,
record_field2 = 5,
record_field3 = 5.4
}
Can I make a new record of the type Sample_Record from a which has one of
it's field modified ?

No comments:

Post a Comment