PLAY PODCASTS
007: Extending Elm
Episode 7

007: Extending Elm

We discuss what Elm is intended for, techniques for going beyond that, and how to make tools nice to use when you do.

Elm Radio

June 29, 202058m 54s

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

What can you do with Elm?

  • Html
  • Http
  • Ports
  • Web Components

Different techniques for extending elm

elm-hot and elm-hot-webpack-loader

Pitfalls and considerations

Codegen

  • Have a single clear source of truth for codegen
  • Prevent bad states with airtight abstractions, rather than having lots of caveats
  • Make sure public APIs for generated code look nice
  • Use doc comments

Macros

  • Elm code that doesn’t look like elm code
  • Tooling doesn’t work then - see Babel ecosystem
  • Violates Open close principle - you’re modifying the language, not extending it

Provide a platform with extensions in mind when you build tools so you don’t require users to hack

When you build a tool, think about the mental model for uses, let that guide you. Avoid leaky abstractions

Be opinionated about the core things, and unopionated about what’s not essential to the tool

  • [elm-spa](https://github.com/ryannhg/elm-spa)