I enjoyed thinking my way through this project. To make it a little more challenging I had two additional goals of my own.
- To have a clean separation between the UI and the application logic.
- To have an example where tests (in spite of types) are helpful in catching bugs.
You can read more of my thoughts here in the project's README.
Here's my demo and the source code.
Whether you choose to just read the code or to build the project you will learn the following:
- How to separate UI and application logic via a concrete example.
- How to represent a state machine using union types. The state machine is what drives the input to the calculator and it is fully tested.
- How to write tests in Elm.
- The importance of testing even in a typed functional language.
- How to implement a stack.
- How to implement the shunting yard algorithm.
- A neat algorithm for displaying rational numbers as decimals, for e.g. displaying
1/6
as0.1(6)
. - How to iteratively add features to an application, commit by commit.
If you want to learn by doing or even contribute to the project then you can try tackling these issues.
Let me know in the comments if you'd be interested in a more detailed analysis of this project via a tutorial or otherwise.
Top comments (0)