Sveriges mest populära poddar

Elm Radio

002: Intro to Opaque Types

40 min • 3 april 2020

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

Kategorier
Förekommer på
00:00 -00:00