{"id":13765302,"url":"https://github.com/mellson/rescript-intro","last_synced_at":"2025-08-03T13:18:44.175Z","repository":{"id":42630943,"uuid":"384878194","full_name":"mellson/rescript-intro","owner":"mellson","description":"Repo for ReScript intro workshop","archived":false,"fork":false,"pushed_at":"2023-01-07T09:06:20.000Z","size":309,"stargazers_count":7,"open_issues_count":4,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-08-03T16:08:46.360Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mellson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-11T06:41:15.000Z","updated_at":"2024-06-14T06:24:37.000Z","dependencies_parsed_at":"2023-02-06T18:17:40.970Z","dependency_job_id":null,"html_url":"https://github.com/mellson/rescript-intro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellson%2Frescript-intro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellson%2Frescript-intro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellson%2Frescript-intro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mellson%2Frescript-intro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mellson","download_url":"https://codeload.github.com/mellson/rescript-intro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221671935,"owners_count":16861330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T16:00:36.726Z","updated_at":"2024-10-27T11:57:00.116Z","avatar_url":"https://github.com/mellson.png","language":"JavaScript","readme":"# ReScript Intro\n\nThis repo is a used to support [this meetup](https://www.meetup.com/spiced-academy/events/279779940) where we build a calculator Using ReScript, React + Tailwind.\n\nYou can find an example of the calculator deployed [here](https://rescript-calculator.netlify.app/). This code to this version of the calculator is available in the example branch of this repo.\n\n## Tech Stack\n\nThe technologies used in this project:\n\n- [ReScript](https://rescript-lang.org/)\n- React in the form of [rescript-react](https://rescript-lang.org/docs/react/latest/introduction#sidebar)\n- [TailwindCSS](https://tailwindcss.com/)\n- [Vite.js](https://vitejs.dev/)\n\n## Getting started\n\nThe project includes a .vscode folder with extension suggestions and setup for running in vscode.\n\n1. Install the dependencies by running `yarn`.\n\n2. Open this repo in vscode and install the suggested extension. The theme used in the meetup is [GitHub Theme](https://marketplace.visualstudio.com/items?itemName=GitHub.github-vscode-theme) in the dark variant.\n\n3. Open a `.res` file, for instance `App.res` and start the build which should be suggested by the popup in the bottom right corner.\n\n4. Start Vite by running `yarn dev`.\n\n5. Open http://localhost:3000 and you should be up and running.\n\n# Building the calculator\n\n![Example calculator](media/calculator.png)\n\nThis is how the example calculator looks like. This is a basic calculator that supports addition, subtraction, multiplication and division. To support these operations, the calculator is built around a simple state machine. There's a very basic state machine implementation in the `src/Machine.res` file. This allows you to create an instance of the state machine and use it to create the calculator.\n\n## States\n\nThe states we need for the example calculator is shown in the following diagram.\n\n```\n                                          ┌────DigitPressed\n                                          │         │\n                                          ▼         │\n┌─────────────┐                    ┌─────────────┐  │\n│             │                    │             │  │\n│   Initial   │────DigitPressed───▶│   Typing    │──┘\n│             │                    │             │\n└─────────────┘                    └─────────────┘\n       ▲                           │      ▲      │\n       │                           │      │   OperationPressed       OperationPressed\n       ├───────────ClearPressed────┘      │      └────────┐      ┌────or DigitPressed\n       │                                  │               │      │         │\n       │                                  │               ▼      ▼         │\n       │                                  │               ┌─────────────┐  │\n       │                                  │               │             │  │\n       ├───────────ClearPressed───────────┼───────────────│  Operating  │──┘\n       │                                  │               │             │\n       │                                  │               └─────────────┘\n       │                                  │               ▲      │\n       │                                  │               │      │\n       │                                  │               │   EqualsPressed\n       │                                  │               │      │\n       │                                  │     OperationPressed │      ┌───EqualsPressed\n       │                                  │               │      │      │         │\n       │                                  │               │      ▼      ▼         │\n       │                            DigitPressed          └──────┌─────────────┐  │\n       │                                  │                      │             │  │\n       │                                  └──────────────────────│   Result    │──┘\n       │                                                         │             │\n       └───────────ClearPressed──────────────────────────────────└─────────────┘\n```\n\n## Great to know\n\nYou can find a really helpful online ReScript community at the official [ReScript forum](https://forum.rescript-lang.org/).\n","funding_links":[],"categories":["ReScript"],"sub_categories":["Example Apps"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellson%2Frescript-intro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmellson%2Frescript-intro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmellson%2Frescript-intro/lists"}