A pure functional finite state machine data structure for Elixir, designed for use within existing processes without requiring separate process management.
Fsm is a pure functional finite state machine library for Elixir, implemented as an immutable data structure. It solves the problem of embedding state machines within existing processes without the overhead of managing separate processes, unlike OTP's gen_fsm. It provides a side-effect-free, composable way to model state transitions with support for data storage and dynamic definitions.
Elixir developers who need to implement state machines within existing processes, such as inside gen_servers or plain processes, and prefer a functional, immutable approach over process-based solutions like gen_fsm.
Developers choose Fsm because it eliminates the complexity of process management and cross-process communication, offering a simpler, more composable alternative to gen_fsm. Its pure functional design and support for data and dynamic definitions make it both robust and flexible for embedded state machine needs.
Finite State Machine data structure
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The FSM is implemented as an immutable data structure, making it side-effect-free and easier to test and reason about, as emphasized in the philosophy for simplicity and composability.
It eliminates the need for separate processes, allowing embedding within existing gen_servers or ETS without cross-process communication complexities, reducing supervision and linking overhead.
Supports data storage alongside state, similar to gen_fsm, enabling more complex state machines with associated data, as demonstrated in the data examples with pattern matching.
Macros are runtime-friendly, allowing FSMs to be built dynamically from external definitions, useful for configuration-driven state machines, as shown in the dynamic definitions section.
The author explicitly states the project is not maintained and advises against using it, meaning no future bug fixes, updates, or security patches, making it risky for production.
The README suggests that regular Elixir data structures with pattern matching can achieve the same goals, making the library potentially unnecessary and adding dependency bloat.
Being deprecated, there is minimal community, documentation, or third-party integrations, increasing the burden on developers to troubleshoot or extend functionality independently.