Safe Haskell | None |
---|---|
Language | GHC2021 |
TypedFsm
Description
This package defines the typed-fsm framework. This module re-exports the public API.
FSM stands for Finite State Machine.
The typed-fsm is used to define and execute FSM.
Advantages of type-fsm:
- Focus on the right message.
- Top-to-bottom design for easy refactoring.
- Conducive to building complex state machine systems:
- * Type guarantees will not produce incorrect function calls when written.
- * With the help of the type system, we can define many state processing functions and then call each other recursively with confidence.
- There is a sanity check. If you miss some items for pattern matching, the compiler will issue a warning, and there will also be a warning for invalid items.
In order to use do syntax, the QualifiedDo
extension is required.
The QualifiedDo extension allows us to overload only the two operators (>>=) and (>>).
Prior to ghc 9.10.1, this extension had serious issues, But this MR fixes these problems! !
The latest ghc 9.10.1 contains this MR. So this library requires you to update the ghc version to 9.10.1.
Using typed-fsm will go through the following five steps:
- Define status
- Define state transfer messages
- Build status processing function
- Construct functions from events to messages in different states
- Running status processing function
Here are some examples:
Synopsis
- module TypedFsm.Core
- module TypedFsm.Driver.Common
- module TypedFsm.Driver.General
- module TypedFsm.Driver.Op