{"id":25405492,"url":"https://github.com/trebor-huang/ice1000","last_synced_at":"2025-08-30T14:13:06.538Z","repository":{"id":37693229,"uuid":"481943697","full_name":"Trebor-Huang/ice1000","owner":"Trebor-Huang","description":"🧊 A Elbereth Gilthoniel / silivren penna míriel! 🌟","archived":false,"fork":false,"pushed_at":"2022-06-25T02:14:03.000Z","size":677,"stargazers_count":19,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-28T22:50:40.770Z","etag":null,"topics":["programming-language"],"latest_commit_sha":null,"homepage":"","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/Trebor-Huang.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}},"created_at":"2022-04-15T11:57:24.000Z","updated_at":"2025-05-15T15:09:18.000Z","dependencies_parsed_at":"2022-07-29T08:49:57.001Z","dependency_job_id":null,"html_url":"https://github.com/Trebor-Huang/ice1000","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Trebor-Huang/ice1000","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trebor-Huang%2Fice1000","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trebor-Huang%2Fice1000/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trebor-Huang%2Fice1000/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trebor-Huang%2Fice1000/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trebor-Huang","download_url":"https://codeload.github.com/Trebor-Huang/ice1000/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trebor-Huang%2Fice1000/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272858550,"owners_count":25005094,"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-08-30T02:00:09.474Z","response_time":77,"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":["programming-language"],"created_at":"2025-02-16T04:35:34.282Z","updated_at":"2025-08-30T14:13:06.509Z","avatar_url":"https://github.com/Trebor-Huang.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ice1000\n\u003e A Elbereth Gilthoniel  \n\u003e silivren penna míriel!\n\nA small programming language based on polarization.\n\n![Simple type theory is so great](img/Suppression1.png)\n\n# Techniques\n\n![I wonder how, I wonder why](img/Suppression2.png)\n\n(...)\n\n# Sample Program\n\n![Perfection](img/Suppression5.jpg)\n\nPseudocode on what programs should look like.\n\n```\n-- Ordinary routines, Builtin functions\nradius( a : Float , b : Float ) : Float\n  = sqrt( mulf(a,a) , mulf(b,b) )\n  -- No fancy infix but it's easy to add\n\n-- Case\nandb( a : Bool , b : Bool ) : Bool\n  = \\case a, b {  -- keywords are prefixed with a backslash\n    True() , True() =\u003e True()\n      -- Nullary constructors, to keep the parser simple\n    _ , _ =\u003e False()\n  }\n\n-- Hindley Milnor Polymorphism\nk( x : a , y : b ) : a = x\n\n-- Case distinction with zero cases\nfalso( x : Void ) : a\n  = \\case x {}\n```\n\n## Values and continuations\n\n```\nadd_with_cont( x : Int , y : Int , c :~ Int ) : #  -- Note the type!\n  = c # add(x , y)  -- Combining a value with a continuation creates a #.\n\n-- To create a continuation, do a pattern matching\nexample() :~ Int\n  = \\continue {\n    1 =\u003e blabla  -- Return a # here\n    2 =\u003e blabla\n    _ =\u003e blabla\n  }\n```\n\n## Effects\n\n```\n-- I/O\nhw(cont :~ String) : #\n  = [] \u003c- print(\"Your name, please: \")\n  ; [name] \u003c- input()\n  ; [] \u003c- print(concat(\"Hello, \", name))\n  ; cont # name\n\n-- So the syntax\n--   [t1, t2, ...] \u003c- effect(args) ; prog\n-- carries out the effect, puts the result in the t's, and then carries out\n-- prog of type #, where the variables t1, t2, ... can be used. The whole thing\n-- again has type #. This operator is right associative, so you can chain.\n\n-- Exiting is an effect.\nexit() : #\n  = [v] \u003c- abort() ; \\case v {}\n-- abort() returns a Void. During execution it directly exits the program.\n-- This may seem slightly weird but it keeps the semantics uniform. Anyway you\n-- can now use exit() directly to exit without doing this twist.\n```\n\n## Data structures\n\nThere is a slight subtlety in that we deliberately blur the difference of two\nopposite things. So the explanation might get a little bit confusing.\n\nOrdinary datatypes are straightforward:\n\n```\n-- A list of numbers (for simplicity, no polymorphism for now)\n\\data List { Nil() | Cons(head : Float, tail : List) }\n-- You can still give names to these fields (Maybe I can automatically\n-- generate projections? But I'm lazy), you can also choose to use\n-- the _ wildcard.\n\nappend(a : List, b : List) : List\n  = \\case a {\n    Nil() =\u003e b\n    Cons(x, xs) =\u003e Cons(x, append(xs, b))\n  }\n```\n\nThe twist comes where you can also use the `:~` mechanism in datatypes:\n\n```\n\\data Hole { Hole(_ :~ Float) }\n```\n\n(...)\n\nWe can have the eager/lazy distinction on data structures, but I'm too lazy.\nPerhaps we have two keywords like `\\eagerdata` and `\\lazydata`, for which the\nevaluation strategy will change accordingly. Currently I'm just going for all\ncall-by-need.\n\n# Type theory\n\n![Censored](img/Suppression4.jpg)\n\nThe type theory consists of judgements of the form\n\n$$T_1, \\dots, T_n; S_1, \\dots, S_n \\vdash J$$\n\nwhere `J` is either `Program` or `By constructor T` or `By pattern S`.\n\nA program (`#` in concrete syntax) is the result of combining a by-pattern term\nwith a by-constructor term. It can also be created by primitive effects. (...)\n\n# Compiling\nThere are four stages:\n\n- `ice1000` is the full language. After parsing, we translate away some small\n  syntactic sugars; do scope checking and remove all the module stuff.\n- `ice100` is what's left. We then do type checking, and translate pattern matching\n  into case trees.\n- `ice10` is what's left. This does not have type information now. And we proceed\n  to do more optimizations, and compile to bytecode or something\n- `ice1` is the bytecode. Now we may run it in a VM or compile to binary.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrebor-huang%2Fice1000","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrebor-huang%2Fice1000","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrebor-huang%2Fice1000/lists"}