{"id":17754541,"url":"https://github.com/facet-lang/facet","last_synced_at":"2025-03-15T04:31:28.066Z","repository":{"id":49963947,"uuid":"294204180","full_name":"facet-lang/facet","owner":"facet-lang","description":"a functional programming language with algebraic effects and handlers","archived":false,"fork":false,"pushed_at":"2022-05-11T04:49:15.000Z","size":10456,"stargazers_count":81,"open_issues_count":1,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-07-23T21:09:09.119Z","etag":null,"topics":["algebraic-effects","compiler","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facet-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-09T19:04:02.000Z","updated_at":"2024-04-17T20:26:32.000Z","dependencies_parsed_at":"2022-08-23T15:51:18.765Z","dependency_job_id":null,"html_url":"https://github.com/facet-lang/facet","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/facet-lang%2Ffacet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facet-lang%2Ffacet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facet-lang%2Ffacet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facet-lang%2Ffacet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facet-lang","download_url":"https://codeload.github.com/facet-lang/facet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685506,"owners_count":20330980,"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":["algebraic-effects","compiler","programming-language"],"created_at":"2024-10-26T14:02:06.167Z","updated_at":"2025-03-15T04:31:27.704Z","avatar_url":"https://github.com/facet-lang.png","language":"Haskell","readme":"# Facet: a call-by-value functional language with algebraic effects, quantitative type theory, and staging\n\n_Caveat lector:_ facet is quite new, and this document is primarily aspirational. Many things do not work, are not implemented, or are poorly thought-out.\n\n\n## Features\n\n- 📈 functional programming!\n- ✋🏻 strict (call-by-value) evaluation order\n- 👷🏻‍♀️ algebraic effects\n\n\n## Goals\n\n- effects as sole mechanism for ad hoc polymorphism; arithmetic, comparison, etc., performed via effects (thus, can be overridden locally)\n  - some system for (ideally coherent) defaulting\n- quantitative type theory controlling staging and erasure in particular\n  - specialization \u0026 inlining of handlers\n- compilation\n  - fine-grained incremental compilation\n- metaprogramming \u0026 general elaborator reflection via effects\n- syntax desugaring via effects\n- data representation as an effect; peano numerals \u0026 nat-as-int should be interconvertable\n- elaboration, optimization, \u0026 compilation reflected via an effectful DSL\n\n\n## Non-goals\n\n- elision of signature variables; I’m willing to be completely explicit (for now at least)\n\n\n## Development\n\nMake sure you have a recent enough `ghc` (8.10+) and `cabal` (3+); I’m not testing against older versions. On macOS, I recommend `ghcup`.\n\nI do just about everything via `ghci`, which can be conveniently initialized and launched as follows:\n\n```\ncabal build # make sure dependencies are known \u0026 installed\nscript/repl # actually launch the repl\n```\n\n`haskell-language-server` integration is also provided, and I edit in VS Code configured to use it.\n\n\n### Organization\n\nHaskell sources for the compiler \u0026c. are in `src`. Facet sources for its standard libraries are in `lib`.\n\n\n## Syntax\n\nA quick overview of facet’s syntax. Note that this is subject to change.\n\n\n### Comments\n\nLine comments start with `#`. There are no block comments.\n\n```facet\n# comments are like this\n```\n\n\n### Declarations\n\nDeclarations live at the top level of a file, and have a name, a signature, and a body wrapped in braces.\n\n```facet\nunit1 : Unit\n{ unit }\n```\n\nA declaration’s signature gives its type, and can also bind variables. Variables bound in the signature are in-scope in the body.\n\n```facet\nid1 : (x : Unit) -\u003e Unit\n{ x }\n```\n\n\n### Functions\n\nIf we didn’t bind the variable in the signature, we could instead bind it by pattern matching in the body. Function bodies range over any variables unbound in the signature. For example, the above definition of `id1` is equivalent to:\n\n```facet\nid2 : Unit -\u003e Unit\n{ x -\u003e x }\n```\n\nFunctions are typically defined in _curried_ style: a function of two arguments is a function of one argument whose result is a function of one argument. Multiple variables can be bound either in the signature:\n\n```facet\nconst1 : (a : Unit) -\u003e (b : Unit) -\u003e Unit\n{ a }\n```\n\nthe body:\n\n```facet\nconst2 : Unit -\u003e Unit -\u003e Unit\n{ a b -\u003e a }\n```\n\nor a mixture:\n\n```facet\nconst3 : (a : Unit) -\u003e Unit -\u003e Unit\n{ b -\u003e a }\n```\n\nUnused parameters can be ignored with a _wildcard_ pattern, written as `_`, whether in the signature:\n\n```facet\nconst4 : (a : Unit) -\u003e (_ : Unit) -\u003e Unit\n{ a }\n```\n\nor the body:\n\n```facet\nconst5 : Unit -\u003e Unit -\u003e Unit\n{ a _ -\u003e a }\n```\n\nFrom here on, we’ll prefer to bind variables in the signature rather than the body.\n\n\n### Types\n\nFunctions can have type parameters, which are bound in the signature like term variables, but written in initial caps and wrapped in curly braces instead of parentheses:\n\n```facet\nid3 : { A : Type } -\u003e (a : A) -\u003e A\n{ a }\n```\n\nType variables are in scope in the rest of the signature, and in the body. Unlike parameters, they cannot be bound in the body, only in the signature. There is no implicit generalization of free type variables in the signature (or elsewhere); free type are assumed to be globals, and will error if they’re not in scope.\n\nMultiple type variables of the same kind can be bound separately:\n\n```facet\nconst6 : { A : Type } -\u003e { B : Type } -\u003e (a : A) -\u003e (b : B) -\u003e A\n{ a }\n```\n\nor can be combined into a single set of braces:\n\n```facet\nconst7 : { A, B : Type } -\u003e (a : A) -\u003e (b : B) -\u003e A\n{ a }\n```\n\n\n### Data\n\nData types are defined using a similar syntax to other declarations, but with init-caps names (like all Facet types). The block contains a comma-separated list of zero or more _constructors_, with init-lowercase names (like all Facet terms) followed by their types. For example, here is how you would define a boolean type (if one weren’t already defined for you):\n\n```facet\nBool : Type\n{ false : Bool\n, true  : Bool }\n```\n\nConstructors with fields include them in their types:\n\n```facet\nBoolPair : Type\n{ boolPair : Bool -\u003e Bool -\u003e BoolPair }\n```\n\n\n### Patterns\n\nValues can be examined and destructured by means of pattern matching. Function arguments—in curly braces, to the left of the arrow—are matched with patterns. The simplest case is a variable:\n\n```facet\nid : { A : Type } -\u003e A -\u003e A\n{ x -\u003e x }\n```\n\nIf you don’t need to use the argument, you can also use a _wildcard_, written as an underscore (`_`), to ignore it:\n\n```facet\nconst : { A, B : Type } -\u003e A -\u003e B -\u003e A\n{ a _ -\u003e a }\n```\n\nData constructors, introduced by datatypes, can be matched by mentioning their names (and further patterns for any fields) within parentheses; multiple pattern-matching _clauses_ are separated by commas:\n\n```facet\nnot : Bool -\u003e Bool\n{ (false) -\u003e true\n, (true)  -\u003e false }\n```\n\n(Requiring parentheses around constructor patterns allows us to distinguish them from variable patterns, and thus to avoid accidentally introducing bugs when a constructor is renamed or typo’d.)\n\nPatterns are matched in top-down order; the first matching clause will be executed. It is an error for no patterns to match.\n\n_TBD: exhaustiveness; tuples; effect constructors_\n\n\n### Effects\n\n\n### Handlers\n","funding_links":[],"categories":["Haskell","Functional"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacet-lang%2Ffacet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacet-lang%2Ffacet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacet-lang%2Ffacet/lists"}