↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

A Farewell to FRP - Making signals unnecessary with The Elm Architecture

Elm 0.17 adds subscriptions so components can wait for messages while library code handles resource management behind the scenes. The post argues that this makes Elm easier to learn and use, and that signals, addresses, and ports can be replaced by simpler concepts.

Reading notes
#

  • Subscriptions let a component wait for messages such as time updates, location changes, and web socket messages.
  • In the clock example, Time.every sets up a subscription that sends new times into update every second.
  • In the web socket example, WebSocket.send sends messages and WebSocket.listen subscribes to incoming messages.
  • The Elm WebSocket package opens the connection when someone subscribes and closes it when no one needs it.
  • Queuing, reconnecting, and other connection handling happen behind the scenes.
  • The post says most code stays the same in 0.17 and the upgrade plan covers the needed changes.
  • The author says signals are no longer necessary for everyday Elm programming.
  • The scheduler and effect managers support this model, and subscriptions are part of a broader emphasis on concurrency.
  • The release also prepares for commands and subscriptions across web platform APIs and custom backends such as GraphQL, Elixir Phoenix, and Firebase.