Skip to content

Instantly share code, notes, and snippets.

View lindsaykwardell's full-sized avatar

Lindsay Wardell lindsaykwardell

View GitHub Profile
@JSuder-xx
JSuder-xx / MsgAsFunction.elm
Last active March 31, 2022 20:49
Unidirectional data flow with Module Oriented programming by using a function a -> a rather than a sum type command.
-- Demonstrates
-- * Dispatching a function Model -> Model rather than a command/message and subsequently pattern matching in the reducer.
-- * Benefits include
-- * Module Oriented Programming. Grouping related operations with the type. Improved transparency. Better organization.
-- * Good ergonomics for composing larger states from smaller througn the use of Lenses.
-- * Slightly more succinct.
-- * Drawbacks
-- * Replay is lost because messages cannot be serialized.
-- * Logic cannot run in a web worker because functions will not serialize across boundary.
--