# Additional and/or complex examples for elm-codec?

**URL:** <https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270>\
**Category:** Learn\
**Created:** [April 21, 2021, 7:53pm UTC](https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270 "2021-04-21T19:53:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![neurodynamic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/neurodynamic/32/984_2.png) [@neurodynamic](https://discourse.elm-lang.org/u/neurodynamic)\
**Post date:** [April 21, 2021, 7:53pm UTC](https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270/1 "2021-04-21T19:53:59Z")

</div>

Does anyone have some examples of building complicated encoders/decoders with elm-codec? I’m trying to build something fairly complicated and I’m missing reference examples for things like using `map` and `andThen` and combining codecs and stuff.

---

<div class="post-metadata">

**Author:** ![passiomatic](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/passiomatic/32/1250_2.png) [@passiomatic](https://discourse.elm-lang.org/u/passiomatic)\
**Post date:** [April 22, 2021, 7:32am UTC](https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270/2 "2021-04-22T07:32:45Z")

</div>

You can find examples for `map` and `andThen` functions in the `Codecs` module of Em Designer here: [https://github.com/passiomatic/elm-designer/blob/master/src/Codecs.elm](https://github.com/passiomatic/elm-designer/blob/master/src/Codecs.elm)

---

<div class="post-metadata">

**Author:** ![ChrisWellsWood](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/chriswellswood/32/5293_2.png) [@ChrisWellsWood](https://discourse.elm-lang.org/u/ChrisWellsWood)\
**Post date:** [April 22, 2021, 8:21am UTC](https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270/3 "2021-04-22T08:21:34Z")

</div>

I have an example using `map`, `constant` and `set` [here](https://github.com/wells-wood-research/de-stress/blob/44440270e25a052466b4a77ee78e65fca49cdee5/front-end/src/Shared/Design.elm#L67) and a codec for a [recursively defined custom type](https://github.com/wells-wood-research/de-stress/blob/44440270e25a052466b4a77ee78e65fca49cdee5/front-end/src/Shared/Requirement.elm#L292), which is pretty gnarly!

---

<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:** [May 2, 2021, 8:22am UTC](https://discourse.elm-lang.org/t/additional-and-or-complex-examples-for-elm-codec/7270/4 "2021-05-02T08:22:13Z")

</div>

Closed on May 2, 2021, 8:22am UTC

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