{"id":32956859,"url":"https://github.com/ion-lang/ion","last_synced_at":"2025-11-16T16:02:21.100Z","repository":{"id":215164883,"uuid":"67341815","full_name":"ion-lang/ion","owner":"ion-lang","description":"יון no BS JS","archived":false,"fork":false,"pushed_at":"2017-09-13T08:24:18.000Z","size":262,"stargazers_count":80,"open_issues_count":2,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-22T12:30:48.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ion-lang.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":"ROADMAP.md","authors":null}},"created_at":"2016-09-04T11:47:56.000Z","updated_at":"2024-04-22T12:30:48.407Z","dependencies_parsed_at":"2024-01-05T21:14:19.258Z","dependency_job_id":null,"html_url":"https://github.com/ion-lang/ion","commit_stats":null,"previous_names":["ion-lang/ion"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ion-lang/ion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ion-lang%2Fion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ion-lang%2Fion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ion-lang%2Fion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ion-lang%2Fion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ion-lang","download_url":"https://codeload.github.com/ion-lang/ion/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ion-lang%2Fion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284734138,"owners_count":27054622,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"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":[],"created_at":"2025-11-12T23:00:20.489Z","updated_at":"2025-11-16T16:02:21.088Z","avatar_url":"https://github.com/ion-lang.png","language":"JavaScript","funding_links":[],"categories":["Functional Languages that Compile to JavaScript"],"sub_categories":["Lenses"],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg src=\"logo.png\" /\u003e\n\n# ion language\n\nIon is a little language that compiles to JavaScript. It doesn't try to be\ncompletely different than JavaScript, but it attemps to strip it to the minimal\nset of functional features of the language, while extending it to have some\nmore. It relies heavily on libraries supporting\n[Fantasy Land](https://github.com/fantasyland/fantasy-land), such as\n[Ramda](https://github.com/ramda/ramda),\n[Santuary](https://github.com/sanctuary-js/sanctuary) and\n[Folktale](https://github.com/folktale/)\n\n##### One example\n\nThe following example is a solution to the\n[\"async problem\"](https://github.com/plaid/async-problem), using the same tools\nbehind the scenes as the\n[task solution](https://github.com/plaid/async-problem/blob/master/tasks.js).\n\n```js\npath = require('path')\n\nread = path.resolve\n  | fs.readFile\n  | map(toString)\n  | map(split('\\n'))\n  | map(map(fs.readFile))\n  | chain(task.waitAll)\n  | map(map(toString))\n  | map(join(','))\n  | map(put)\n\nread('./index.txt').mapRejected(put).run()\n```\n\n##### Features\n\n- Improved type detection and comparisons;\n- All variables are `const`s;\n- All functions are curried;\n- Blocks can have only one expression, and this is returned by default;\n- Ramda is treated as the stdlib;\n- Operators are seen as functions;\n- Range type (only for integers so far);\n- Some new operators: `-\u003e`, `|`, `@`, `**` and more;\n- `where` construct;\n\nThings removed:\n\n- `this`, `class` and all things OO;\n- `function`: only lambdas;\n- `typeof`: use only `type` function;\n- `switch/case`: use `cond` function;\n- `try/catch`: use `tryCatch` function or `Result`;\n- All mutable ops, like `-=`, `*=`, `++` ...;\n- All 3 char ops, like `===`, `!==`;\n- Many unknown JS features, like `\u003e\u003e`, `\u003e\u003e\u003e`;\n\n\n##### Improved type detection\n```js\n\n// JS          |   // Ion\ntypeof null    |   type(null)\n// 'object'    |   // 'Null'\ntypeof []      |   type([])\n// 'object'    |   // 'Array'\ntypeof {}      |   type({})\n// 'object'    |   // 'Object'\ntypeof /a/     |   type(/a/)\n// 'object'    |   // 'Regexp'\n```\n##### Improved comparisons\n```js\n// JS          |   // Ion\n1 == \"1\"       |   1 == \"1\"\n// true        |   // false\nNaN == NaN     |   NaN == NaN\n// false       |   // true\n[] == []       |   [] == []\n// false       |   // true\n{} == {}       |   {} == {}\n// false       |   // true\n/a/ == /a/     |   /a/ == /a/\n// false       |   // true\n```\n##### All variables are `consts`s\n```js\n// JS          |   // Ion\nconst age = 22 | age = 22\nlet age = 22   | // check \"where\" below\nvar age = 22   | // check \"where\" below\n```\n##### All functions are curried\n```js\nsayTo = (greet, name) =\u003e\n  `${greet}, ${name}!`\nsayTo('Hello', 'John') // 'Hello, John!'\nsayTo('Hello')('John') // 'Hello, John!'\n\nsayHelloTo = sayTo('Hello')\nsayHelloTo('John') // 'Hello, John'\n```\n##### Blocks can have only one expression, and this is returned by default\n```js\nage = 22\nstatus = if(age \u003e= 18)\n  'adult'\nelse\n  'minor'\n\naddFive = (n) =\u003e n + 5  \n```\n##### Ramda is treated as the stdlib\n```js\nmap((a) =\u003e a + 1, [1, 2, 3]) // =\u003e [2, 3, 4]\n```\n##### Operators are seen as functions\n```js\nmap(+(1), [1, 2, 3]) // =\u003e [2, 3, 4]\n```\n##### Range type (only for integers so far)\n```js\nmap(+(1), [1..3]) // =\u003e [2, 3, 4]\n```\n##### Some new operators:\n```js\n// `\u003c-` is map\n\n+(1) \u003c- [1..3] // =\u003e [2, 3, 4]\n\n// `|` is pipe (sorta like in bash)\n\nadd2AndThenMult3 = +(2) | *(3)\nadd2AndThenMult3(1) // =\u003e 9\n\n// `@` gets attribute of object, may be deep\n\n'name' @ {name: 'John'} // =\u003e 'John'\n\n['movies', 0, 'name'] @ {movies: [{name: 'Rambo'}, ...]} // =\u003e 'Rambo'\n\ndupAllPrices = map(@('price') | *(2))\ndupAllPrices([{price: 1}, {price: 2}]) //  =\u003e [2, 4]\n```\n##### `where` construct\nWhere makes sure variables are local, and they are part of an expression.\nIt's a safe substitute for var/let:\n```js\nfoo = (x) =\u003e\n  a + b where\n    a = x * 2,\n    b = x * 3\n```\n\n### Extended types\n\n```js\n// Maybe\n\nMaybe.fromNullable(undefined) // Nothing\nMaybe.fromNullable('john')    // Just(john)\n\n// Result\n\nResult.Ok(5)\nResult.Error('Ooops')\n\n// task (equivalent of Promise)\n\nwait = (secs) =\u003e\n  task.task((resolver) =\u003e\n    resolver.cleanup(() =\u003e clearTimeout(timer)) where\n      timer = setTimeout(() =\u003e resolver.resolve(secs), secs * 1000))\n\n// gets first task to succeed and automatically cleans up others\ntask.waitAny([wait(2), wait(1)]).map(put).run()\n```\n\n## Usage\n\n```\nion -h                    // help\nion -c file.ion           // compiles to JS, returns to stdout\nion -c file.ion \u003e file.js // compiles to JS, writes to file.js\nion -e file.ion           // compiles to JS, executes with node (4+ will work)\nion -a file.ion           // returns ion's AST\nion -r 'put(\"Hello\")'     // executes some arbitrary code\nion -t file.ion           // simply tries parsing and return true or error\n```\n\n## Credits\n\nion is inspired by:\n\n- Ramda;\n- Haskell: operators as functions, currying by default, etc...;\n- Elm/Elixir: nice operators for composition;\n- io: everything is a function / very few reserve words;\n- es6/7: spreads, template strings, lambda syntax...;\n- es5: everything else;\n- Cobol: just kidding;\n\n## Status\n\nIon is still a toy language and far from 1.0. Beware.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fion-lang%2Fion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fion-lang%2Fion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fion-lang%2Fion/lists"}