# Record map syntax

**URL:** https://discourse.elm-lang.org/t/record-map-syntax/6050
**Category:** Request Feedback
**Created:** [July 16, 2020, 6:44pm UTC](https://discourse.elm-lang.org/t/record-map-syntax/6050 "2020-07-16T18:44:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![DullBananas](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dullbananas/32/3709_2.png) [@DullBananas](https://discourse.elm-lang.org/u/DullBananas)
#### Post date: [July 16, 2020, 6:44pm UTC](https://discourse.elm-lang.org/t/record-map-syntax/6050/1 "2020-07-16T18:44:56Z")

</div>

It might be a good idea to add a syntax for applying a function to a record field. For example, this would increase the `amount` field by 1:

```elm
{ record | amount <- (+) 1 }

```

Currently it would have to be done like this which is too repetitive:

```elm
{ record | amount = 1 + record.amount }

```

I’m not sure how often this would be useful. I have found 2 examples in the source code of my EditSC project where this would be useful. Currently they look similar to this:

```elm
{ model | someList = newItem :: model.someList }
{ model | someArray = Array.set index newValue model.someArray }

```

It could look like this instead:

```elm
{ model | someList <- (::) newItem }
{ model | someArray <- Array.set index newValue }

```

---

<div class="post-metadata">

### Author: ![G4BB3R](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/g4bb3r/32/4544_2.png) [@G4BB3R](https://discourse.elm-lang.org/u/G4BB3R)
#### Post date: [July 17, 2020, 1:08am UTC](https://discourse.elm-lang.org/t/record-map-syntax/6050/2 "2020-07-17T01:08:05Z")

</div>

I think it is easier for something to be changed/removed from the language than to add a new syntax. The last time it occurred was in Nov 2016 at 0.18 release, when primes, interpolation and backticks were removed. Elm simplicity gives us some benefits, such as ease of learn and compiler speed.

---

<div class="post-metadata">

### Author: ![DullBananas](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dullbananas/32/3709_2.png) [@DullBananas](https://discourse.elm-lang.org/u/DullBananas)
#### Post date: [July 20, 2020, 1:57am UTC](https://discourse.elm-lang.org/t/record-map-syntax/6050/3 "2020-07-20T01:57:57Z")

</div>

Yeah, programming languages with too many features absolutely suck. I keep on forgetting the enum syntax in typescript (googled it just now)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)
#### Post date: [July 30, 2020, 2:01am UTC](https://discourse.elm-lang.org/t/record-map-syntax/6050/4 "2020-07-30T02:01:26Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
