{"id":13599827,"url":"https://github.com/candy-lang/candy","last_synced_at":"2025-04-10T17:32:38.201Z","repository":{"id":10509540,"uuid":"279060653","full_name":"candy-lang/candy","owner":"candy-lang","description":"🍭 A sweet, functional programming language that is robust, minimalistic, and expressive.","archived":false,"fork":false,"pushed_at":"2024-04-13T21:58:51.000Z","size":20008,"stargazers_count":312,"open_issues_count":111,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-14T10:48:59.617Z","etag":null,"topics":["compiler","fuzzer","hacktoberfest","language","language-server","programming-language","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/candy-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["JonasWanke","marcelgarus"]}},"created_at":"2020-07-12T12:33:04.000Z","updated_at":"2024-04-18T01:48:04.638Z","dependencies_parsed_at":"2024-02-12T01:29:42.049Z","dependency_job_id":"1a978243-ca95-480f-bd05-c326f3df509d","html_url":"https://github.com/candy-lang/candy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candy-lang%2Fcandy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candy-lang%2Fcandy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candy-lang%2Fcandy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/candy-lang%2Fcandy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/candy-lang","download_url":"https://codeload.github.com/candy-lang/candy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223442682,"owners_count":17145816,"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":["compiler","fuzzer","hacktoberfest","language","language-server","programming-language","rust"],"created_at":"2024-08-01T17:01:12.737Z","updated_at":"2024-11-07T01:30:59.763Z","avatar_url":"https://github.com/candy-lang.png","language":"Rust","funding_links":["https://github.com/sponsors/JonasWanke","https://github.com/sponsors/marcelgarus"],"categories":["Rust"],"sub_categories":[],"readme":"# 🍭 Candy\n\n\u003e **🚧 Work in Progress!**\n\u003e\n\u003e Candy is still in its early stages.\n\u003e We are actively working on it, but it's not ready for production use yet.\n\u003e If you want to help, please join our [Discord server].\n\u003e See also: [The current state](#the-current-state).\n\nA sweet, functional programming language that is robust, minimalistic, and expressive.\n\nMany programming languages have a strict separation between compile-time and runtime errors.\nSometimes, this border can seem arbitrary:\nDividing by a string fails during compilation with a type error, while dividing by zero only fails during runtime.\nIn the mathematical sense, there's no fundamental difference between these cases – division is only defined for divisors that are non-zero numbers.\nThat's why we eliminate the border between compile-time and runtime errors – all errors are runtime errors.\nBy crafting high-quality tooling with dynamic analyses such as fuzzing, we try to still be able to show most errors while you're editing the code.\nIn fact, we try to show more errors than typical statically typed languages.\n\n![Candy in VS Code](screenshot.png)\n\n## Quick introduction\n\n- **Values are at the center of your computations.**\n  Only a handful of predefined types of values exist:\n\n  ```candy\n  3                   # int\n  \"Candy\"             # text\n  Green               # tag (uppercase)\n  Error ListIsEmpty   # tag with a value\n  (Foo, Bar)          # list\n  [Name: \"Candy\"]     # struct\n  { it -\u003e add it 2 }  # function\n  ```\n\n- **Minimalistic syntax.**\n  Defining variables and functions works without braces or keywords cluttering up your code.\n  The syntax is indentation-aware.\n\n  ```candy\n  # I'm a comment\n  foo = 42                # variable (lowercase)\n  println message =       # function\n    print message         # function call\n    print \"\\n\"\n  println \"Hello, world!\"\n  ```\n\n- **Extensive compile-time evaluation.**\n  Many values can already be computed at compile-time.\n  In your editor, you'll see the results on the right side:\n\n  ```candy\n  foo = double 2  # foo = 4\n  ```\n\n- **Fuzzing instead of traditional types.**\n  In Candy, functions have to specify their needs _exactly._\n  As you type, the tooling automatically tests your code with many inputs to see if one breaks the code:\n\n  ```candy\n  foo a =             # If you pass a = 0,\n    needs (isInt a)\n    math.logarithm a  # then this panics: The `input` must be a positive number.\n\n  efficientTextReverse text =\n    needs (isText text)\n    needs (isPalindrome text) \"Only palindromes can be efficiently reversed.\"\n    text\n\n  greetBackwards name =                   # If you pass name = \"Test\",\n    \"Hello, {efficientTextReverse name}\"  # then this panics: Only palindromes can be efficiently reversed.\n  ```\n\nFor more info, read:\n\n- Marcel's blog post about Candy: https://marcelgarus.dev/candy\n- the [language documentation](language.md)\n- Marcel's blog post about Candy's compiler pipeline: https://marcelgarus.dev/candy-compiler-pipeline\n\n## The current state\n\nWe are currently implementing a first version of Candy in Rust.\nWe already have a CLI, language server, and Visual Studio Code extension that provide some tooling.\n\nThe language is still in its early stages, and we are actively working on it.\nThere are still compiler bugs and performance improvements that need work before this language is ready for production use.\n\n## Discussion\n\n[Join our \u003cimg height=\"12\" src=\"https://github.com/candy-lang/candy/assets/19330937/baf90ce0-1d0a-4279-92fa-1c360cd28b38\"\u003e Discord server.][Discord server]\n\n## How to use Candy\n\n1. Install [\u003cimg height=\"16\" src=\"https://rust-lang.org/static/images/favicon.svg\"\u003e Rust](https://rust-lang.org): [rust-lang.org/tools/install](https://rust-lang.org/tools/install) (use Rustup since we use nightly features).\n   - Alternatively, use the provided [\u003cimg height=\"16\" src=\"https://nixos.org/_astro/flake-blue.Bf2X2kC4_Z1yqDoT.svg\"\u003e Nix](https://nixos.org/) flake to install all required dependencies.\n2. Clone this repo.\n\nThen, you can use Candy in two ways:\n\n### Use the VS Code Extension\n\n1. Install [\u003cimg height=\"16\" src=\"https://code.visualstudio.com/favicon.ico\"\u003e Visual Studio Code (VS Code)](https://code.visualstudio.com): [code.visualstudio.com/download](https://code.visualstudio.com/download).\n2. Open the workspace (`compiler.code-workspace`) in VS Code.\n3. Install the recommended VS Code extensions.\n4. Run `npm install` inside `vscode_extension/`.\n5. Run the launch config “Run Extension (VS Code Extension)”.\n6. In the new VS Code window that opens, you can enjoy 🍭 Candy :)\n\nIf you are working on the Rust code itself, you might want to disable release mode for quicker compilation:\nIn `packages/candy.code-workspace`, in the `candy.languageServerCommand` setting, remove `--release`.\n(But don't commit that change.)\n\n### Use the CLI\n\nFrom the root of this repository, you can run the Candy CLI by starting the Candy commands with `cargo run --release --`:\n\n```sh\n# Run a Candy file:\ncargo run --release -- run ./packages/Examples/helloWorld.candy\n\n# View all available commands:\ncargo run --release -- help\n```\n\n(Everything after `--` is passed to Candy, everything before it to Cargo.)\n\n## Environment Variables for Debugging the Compiler\n\n```sh\n# Don't normalize IDs (number them sequentially) after optimizing the MIR.\nCANDY_MIR_NORMALIZE_IDS=false\n\n# Generate a _large_ Markdown file that lists every single optimization step\n# performed on the MIR.\nCANDY_MIR_OPTIMIZATION_LOG=target/optimization-log.md\n```\n\n[Discord server]: https://discord.gg/5Vr4eAJ7gU\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandy-lang%2Fcandy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcandy-lang%2Fcandy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandy-lang%2Fcandy/lists"}