PLAY PODCASTS
032: Elm's Universal Pattern
Episode 32

032: Elm's Universal Pattern

Guest Joël Quenneville shares his wisdom on transforming and mapping in Elm, and how it applies across many Elm data types.

Elm Radio

June 7, 20211h 14m

Audio is streamed directly from the publisher (cdn.simplecast.com) as published in their RSS feed. Play Podcasts does not host this file. Rights-holders can request removal through the copyright & takedown page.

Show Notes

Metaphors

Some common metaphors for Elm's Universal Pattern (Applicative Pattern).

Examples

  • Random generators
  • Apply mapping functions to vanilla value functions to keep things clean

Tips

Record constructors

Some more blog posts by Joël that related to Elm's Universal Pattern:

Joël's journey to building a parser combinator:

  • Nested cases - https://ellie-app.com/b9nGmZVp9Vca1
  • Extracted Result functions - https://ellie-app.com/b9qtqTf8zYda1
  • Introducing a Parser alias and map2 - https://ellie-app.com/b9MwZ3y4t8ra1
  • Re-implementing with elm/parser - https://ellie-app.com/b9NZhkTGdfya1
  • Getting Unstuck with Elm JSON Decoders - because mapping is universal, you can solve equivalent problems with the same pattern (described in this post)