{"id":50683021,"url":"https://github.com/armcn/quone-lang","last_synced_at":"2026-06-08T20:30:37.476Z","repository":{"id":352036004,"uuid":"1211995009","full_name":"armcn/quone-lang","owner":"armcn","description":"A statically typed functional language that compiles to readable R code","archived":false,"fork":false,"pushed_at":"2026-04-17T15:13:12.000Z","size":588,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-17T16:38:04.154Z","etag":null,"topics":["functional-programming","rstats"],"latest_commit_sha":null,"homepage":"https://quone-lang.org","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/armcn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-16T00:49:00.000Z","updated_at":"2026-04-17T15:13:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/armcn/quone-lang","commit_stats":null,"previous_names":["armcn/quone-lang"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/armcn/quone-lang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcn%2Fquone-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcn%2Fquone-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcn%2Fquone-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcn%2Fquone-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/armcn","download_url":"https://codeload.github.com/armcn/quone-lang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armcn%2Fquone-lang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34080025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["functional-programming","rstats"],"created_at":"2026-06-08T20:30:33.254Z","updated_at":"2026-06-08T20:30:37.470Z","avatar_url":"https://github.com/armcn.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Project moved to https://github.com/quone-lang\n\n# Quone\n\nQuone is a statically typed functional language that compiles to R. If you like R's data ecosystem but want type safety, algebraic data types, and a clean syntax — Quone gives you that without leaving R behind.\n\nEvery Quone program compiles to readable, idiomatic R. No runtime. No FFI. Just `.Q` in, `.R` out.\n\n\u003e **Note:** Quone is an early experiment built with AI-assisted coding. It may or may not continue to be developed — treat it as a proof of concept, not a production tool. Expect rough edges, missing features, and breaking changes.\n\u003e\n\u003e The name follows the lineage of statistical languages: S, then R (the letter before S), then Q. It's also a reference to the [Seinfeld Scrabble scene](https://www.youtube.com/watch?v=fzPy8kSn7o0) where Kramer plays \"quone\" — a word that doesn't exist but sounds like it should.\n\n## Why Quone?\n\nR is powerful for data work, but dynamically typed code breaks in production. Quone catches errors at compile time while generating the same R you'd write by hand:\n\n- **Type-checked dplyr** — column names and types are verified before your code ever runs\n- **Vectorization for free** — simple lambdas over vectors compile to vectorized R expressions, not `purrr::map_dbl` loops\n- **Full type inference** — write clean code without type annotations; add them when you want documentation\n- **Algebraic data types** — model your domain precisely with sum types and pattern matching\n- **Pipes that work** — `|\u003e` compiles to R's native pipe\n\n## Quick Start\n\n```bash\ncabal install\nquone examples/dplyr.Q       # compile to R\nquone examples/rmse.Q        # another example\nquone repl                   # interactive REPL\n```\n\n## Examples\n\n### Data manipulation with dplyr\n\nDefine a typed schema, build a dataframe, and transform it — the compiler checks that every column reference and operation is valid.\n\n```elm\nlibrary dplyr\n\nimport desc : a -\u003e a\nimport n : a -\u003e Integer\n\ntype alias Students \u003c-\n    dataframe\n        { name : Vector Character\n        , score : Vector Double\n        , dept : Vector Character\n        }\n\nstudents : Students\nstudents \u003c-\n    dataframe\n        { name = [\"Alice\", \"Bob\", \"Carol\", \"Dan\", \"Eve\"]\n        , score = [92.0, 78.0, 85.0, 64.0, 91.0]\n        , dept = [\"math\", \"cs\", \"math\", \"cs\", \"math\"]\n        }\n\nresult \u003c-\n    students\n    |\u003e filter (score \u003e 70.0)\n    |\u003e mutate { pct = score / 100.0 }\n    |\u003e arrange (desc score)\n```\n\nCompiles to:\n\n```r\nlibrary(dplyr)\n\nstudents \u003c- data.frame(\n  name = c(\"Alice\", \"Bob\", \"Carol\", \"Dan\", \"Eve\"),\n  score = c(92.0, 78.0, 85.0, 64.0, 91.0),\n  dept = c(\"math\", \"cs\", \"math\", \"cs\", \"math\")\n)\n\nresult \u003c- students |\u003e\n  dplyr::filter(score \u003e 70.0) |\u003e\n  dplyr::mutate(pct = score / 100.0) |\u003e\n  dplyr::arrange(desc(score))\n```\n\nTry `mutate { grade = name / 100.0 }` — the compiler tells you `'name' is Character, cannot use '/'` before you ever run R.\n\n### Automatic vectorization\n\n```elm\nrmse : Vector Double -\u003e Vector Double -\u003e Double\nrmse predicted actual \u003c-\n    map2 (\\p a -\u003e p - a) predicted actual\n    |\u003e map (\\e -\u003e e * e)\n    |\u003e mean\n    |\u003e sqrt\n```\n\nCompiles to:\n\n```r\nrmse \u003c- function(predicted, actual) {\n  (predicted - actual) |\u003e\n    (\\(.x) .x * .x)() |\u003e\n    mean() |\u003e\n    sqrt()\n}\n```\n\nThe `map2` and `map` calls are fused into vectorized arithmetic — no element-wise iteration.\n\n### Algebraic data types\n\n```elm\ntype Option a\n    \u003c- None\n    | Some a\n\nmap_option : (Integer -\u003e Integer) -\u003e Option Integer -\u003e Option Integer\nmap_option f opt \u003c-\n    case opt of\n        None -\u003e\n            None\n\n        Some x -\u003e\n            Some (f x)\n\nresult : Option Integer\nresult \u003c-\n    map_option (\\x -\u003e x + 1) (Some 41)\n```\n\n### Let bindings\n\n```elm\nstd_dev : Vector Double -\u003e Double\nstd_dev xs \u003c-\n    let\n        avg \u003c- mean xs\n        n \u003c- to_double (length xs)\n        sum_sq \u003c- map (\\x -\u003e (x - avg) * (x - avg)) xs |\u003e sum\n    in\n    sqrt (sum_sq / n)\n```\n\n## Type System\n\nTypes map directly to R — no wrappers, no boxing:\n\n| Quone | R |\n|---|---|\n| `Integer` | `integer` |\n| `Double` | `double` |\n| `Logical` | `logical` |\n| `Character` | `character` |\n| `Vector a` | atomic vector |\n| `{ name : a, ... }` | named list |\n| `dataframe { ... }` | `data.frame` |\n\nType inference is Hindley-Milner. Annotations are always optional but checked when present.\n\n## Built-in Functions\n\n| Function | Type | R |\n|---|---|---|\n| `map` | `(a -\u003e b) -\u003e Vector a -\u003e Vector b` | vectorized or `purrr::map_dbl` |\n| `map2` | `(a -\u003e b -\u003e c) -\u003e Vector a -\u003e Vector b -\u003e Vector c` | vectorized or `purrr::map2_dbl` |\n| `reduce` | `(b -\u003e a -\u003e b) -\u003e b -\u003e Vector a -\u003e b` | `purrr::reduce` |\n| `keep` | `(a -\u003e Logical) -\u003e Vector a -\u003e Vector a` | `purrr::keep` |\n| `discard` | `(a -\u003e Logical) -\u003e Vector a -\u003e Vector a` | `purrr::discard` |\n| `mean` | `Vector a -\u003e Double` | `mean` |\n| `sum` | `Vector a -\u003e Double` | `sum` |\n| `length` | `Vector a -\u003e Integer` | `length` |\n| `sqrt` | `Double -\u003e Double` | `sqrt` |\n| `to_double` | `Integer -\u003e Double` | `as.numeric` |\n\n## dplyr Verbs\n\nAll verbs are type-checked against the dataframe schema:\n\n| Verb | Quone | R |\n|---|---|---|\n| Select columns | `select name score` | `dplyr::select(name, score)` |\n| Filter rows | `filter (score \u003e= 80.0)` | `dplyr::filter(score \u003e= 80.0)` |\n| Add columns | `mutate { pct = score / 100.0 }` | `dplyr::mutate(pct = score / 100.0)` |\n| Aggregate | `summarize { avg = mean score }` | `dplyr::summarize(avg = mean(score))` |\n| Group | `group_by dept` | `dplyr::group_by(dept)` |\n| Sort | `arrange (desc score)` | `dplyr::arrange(desc(score))` |\n\n## REPL\n\n```bash\nquone repl\n```\n\n```\nquone\u003e x \u003c- [1.0, 2.0, 3.0, 4.0]\nx : Vector Double\nquone\u003e x |\u003e map (\\n -\u003e n * n) |\u003e mean\n[1] 7.5\nquone\u003e :t mean\nVector a -\u003e Double\nquone\u003e :q\n```\n\nMulti-line input is automatic — the REPL continues reading on `\u003c-`, `|\u003e`, and unbalanced brackets.\n\n## Editor Support\n\nA Cursor/VS Code extension is included at `editors/cursor/quone-lang/` with syntax highlighting, diagnostics, hover types, and formatting.\n\n## Usage\n\n```bash\nquone program.Q              # compile to R (stdout)\nquone program.Q --format     # format source code\nquone program.Q --package    # generate an R package\nquone repl                   # interactive REPL\n```\n\n## R Package\n\nUse Quone directly from R without touching the command line:\n\n```r\n# install.packages(\"pak\")\npak::pak(\"armcn/quone-lang/r-package\")\nquone::install_quone()\n\nquone::source_quone(\"analysis.Q\")   # compile + evaluate\nquone::check(\"analysis.Q\")          # type-check only\nquone::repl()                       # interactive REPL\n```\n\nSee [r-package/](r-package/) for full documentation.\n\n## Building\n\nRequires GHC and Cabal ([GHCup](https://www.haskell.org/ghcup/)).\n\n```bash\ncabal build\ncabal install\n```\n\n## More Examples\n\n- [rmse.Q](examples/rmse.Q) — vectorized RMSE with pipes\n- [dplyr.Q](examples/dplyr.Q) — typed dplyr pipelines\n- [option.Q](examples/option.Q) — algebraic data types and pattern matching\n- [normalize.Q](examples/normalize.Q) — z-score normalization with let bindings\n- [records.Q](examples/records.Q) — record types and field access\n- [dataframe.Q](examples/dataframe.Q) — dataframe construction\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmcn%2Fquone-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmcn%2Fquone-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmcn%2Fquone-lang/lists"}