# Nice builder pattern

**URL:** <https://discourse.elm-lang.org/t/nice-builder-pattern/10475>\
**Category:** Show and Tell\
**Created:** [November 1, 2025, 11:00am UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475 "2025-11-01T11:00:43Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![dta](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dta/32/1917_2.png) [@dta](https://discourse.elm-lang.org/u/dta)\
**Post date:** [November 4, 2025, 3:29pm UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475/21 "2025-11-04T15:29:48Z")

</div>

> [@rupert](#):
>
> ```auto
> example : LongOptionalRecord
> example =
> builder "id-123" "Widget"
> .addParam "p1"
> .addParam "p2"
> .withAttr "env" "prod"
> .withOption "special"
> .addAndSoOn 42
> .addAndSoOn 7
> .build
> 
> ```

Was this missing `|>` operators? I’m having a hard time understanding how to parse it otherwise

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [November 4, 2025, 3:39pm UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475/22 "2025-11-04T15:39:40Z")

</div>

> [@dta](#):
>
> Another option is to stick each of the functions you want to qualify in a record. They can stay in the same module, but will be “namespaced”.

Yes, that is exactly what I have done - namespaced a set of functions as a record.

---

<div class="post-metadata">

**Author:** ![rupert](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rupert/32/1775_2.png) [@rupert](https://discourse.elm-lang.org/u/rupert)\
**Post date:** [November 4, 2025, 3:40pm UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475/23 "2025-11-04T15:40:34Z")

</div>

> [@dta](#):
>
> Was this missing `|>` operators? I’m having a hard time understanding how to parse it otherwise

Yes, my bad. Not an AI halucination so much as a human one!! I guess that code would be the “ideal” if not actually legal Elm.

---

<div class="post-metadata">

**Author:** ![dta](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dta/32/1917_2.png) [@dta](https://discourse.elm-lang.org/u/dta)\
**Post date:** [November 4, 2025, 3:49pm UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475/24 "2025-11-04T15:49:35Z")

</div>

I haven’t looked back through it, but this is reminding me of this [thread](https://discourse.elm-lang.org/t/demystifying-jeremys-interfaces/8834)

---

<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:** [November 14, 2025, 3:49pm UTC](https://discourse.elm-lang.org/t/nice-builder-pattern/10475/25 "2025-11-14T15:49:45Z")

</div>

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

[Previous page](https://discourse.elm-lang.org/t/nice-builder-pattern/10475.md?page=1)
