Elm Radio

002: Intro to Opaque Types


Listen Later

Opaque Types

Some patterns

  • Runtime validations - conditionally return type, wrapped in Result or Maybe
  • Guarantee constraints through the exposed API of the module (like PositiveInteger or AuthToken examples)
Package-Opaque Modules

Example - the Element type in elm-ui.
Definition of the Element type alias

elm-ui's elm.json file does not expose the internal module where the real Element type is defined.

Example from elm-graphql codebase - CamelCaseName opaque type

...more
View all episodesView all episodes
Download on the App Store

Elm RadioBy Dillon Kearns, Jeroen Engels

  • 5
  • 5
  • 5
  • 5
  • 5

5

16 ratings