{"id":24130712,"url":"https://github.com/tsuberim/fun","last_synced_at":"2025-10-12T13:07:39.410Z","repository":{"id":269213260,"uuid":"903510374","full_name":"tsuberim/fun","owner":"tsuberim","description":"A purely fun-ctional language with amazing performance","archived":false,"fork":false,"pushed_at":"2025-07-05T05:59:46.000Z","size":21086,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T13:07:38.883Z","etag":null,"topics":["functional-programming","haskell","hindley-milner","python"],"latest_commit_sha":null,"homepage":"https://tsuberim.github.io/fun/","language":"HTML","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/tsuberim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-14T19:32:27.000Z","updated_at":"2025-07-05T05:59:50.000Z","dependencies_parsed_at":"2025-03-01T06:39:32.701Z","dependency_job_id":"2fcc5f09-4e2c-4211-bfac-63e86e658958","html_url":"https://github.com/tsuberim/fun","commit_stats":null,"previous_names":["tsuberim/fun"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tsuberim/fun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuberim%2Ffun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuberim%2Ffun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuberim%2Ffun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuberim%2Ffun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsuberim","download_url":"https://codeload.github.com/tsuberim/fun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuberim%2Ffun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011469,"owners_count":26084947,"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-10-12T02:00:06.719Z","response_time":53,"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","haskell","hindley-milner","python"],"created_at":"2025-01-11T20:35:53.554Z","updated_at":"2025-10-12T13:07:39.405Z","avatar_url":"https://github.com/tsuberim.png","language":"HTML","readme":"# Fun Programming Language\n\nA purely functional programming language with type inference, built in Go with Tree-sitter parsing and LSP support.\n\n## Features\n\n- **Functional Programming**: Lambda expressions, pattern matching, and immutable data structures\n- **Type System**: Hindley-Milner type inference with polymorphic types\n- **Pattern Matching**: `when` expressions with constructor patterns\n- **Records**: Named field data structures with type safety\n- **Lists**: Immutable list data structures\n- **Modules**: Import system for code organization\n- **REPL**: Interactive development environment\n- **LSP Support**: Language Server Protocol for IDE integration\n- **Tree-sitter Grammar**: Robust parsing with syntax highlighting\n\n## Quick Start\n\n### Installation\n\n```bash\ngit clone \u003crepository\u003e\ncd fun\ngo build\n```\n\n### Running Programs\n\n```bash\n# Run a file\n./fun examples/basic/main\n```\n\n# Start REPL\n./fun\n\n# Start LSP server\n./fun lsp\n```\n\n### Example\n\n```fun\nimport lib from `./lib`\n\n# computes the sum of integers from 1..n\nsum_range : Lam\u003cInt, Int\u003e\nsum_range = fix(\\rec -\u003e \\n -\u003e\n    when n == 0 is\n        True t -\u003e 0;\n        False f -\u003e n + rec(lib.dec(n))\n)\n\nsum_range(100) # result: 5050\n```\n\n## Language Features\n\n### Basic Types\n\n- **Integers**: `42`, `-17`\n- **Strings**: `` `hello world` ``\n- **String Templates**: `` `hello {name}` ``\n\n### Functions\n\n```fun\n# Lambda expressions\ninc = \\x -\u003e x + 1\n\n# Function application\ninc(5)  # result: 6\n\n# Multi-parameter functions\nadd = \\x, y -\u003e x + y\n```\n\n### Pattern Matching\n\n```fun\nwhen value is\n    Just x -\u003e x;\n    Nothing -\u003e 0\nelse 42\n```\n\n### Records\n\n```fun\n# Record construction\nperson = {name: \"Alice\", age: 30}\n\n# Record access\nperson.name  # result: \"Alice\"\n\n# Record with type annotation\nperson : {name: Str, age: Int}\nperson = {name: \"Bob\", age: 25}\n```\n\n### Lists\n\n```fun\n# List construction\nnumbers = [1, 2, 3, 4, 5]\n\n# Empty list\nempty = []\n```\n\n### Type Annotations\n\n```fun\n# Explicit type annotation\nfactorial : Lam\u003cInt, Int\u003e\nfactorial = \\n -\u003e when n == 0 is\n    True -\u003e 1;\n    False -\u003e n * factorial(n - 1)\n```\n\n### Modules\n\nModules allow you to organize code across multiple files. Each file is a module that can export values and import from other modules. The `.fun` extension is the conventional choice.\n\n#### Creating a Module\n\n```fun\n# lib.fun - a utility module\ninc = \\x -\u003e x + 1\ndec = \\x -\u003e x - 1\n\n# Export values by returning a record\n{\n    inc: inc,\n    dec: dec\n}\n```\n\n#### Importing Modules\n\n```fun\n# main.fun - importing and using the lib module\nimport lib from `./lib`\n\n# Use imported functions\nresult1 = lib.inc(5)    # result: 6\nresult2 = lib.dec(10)   # result: 9\n\n# You can also import with a different name\nimport utils from `./lib`\nresult3 = utils.inc(3)  # result: 4\n```\n\n#### Module Paths\n\nImport paths use backticks and can be:\n- **Relative paths**: `./lib`, `../utils/math`\n- **File extensions**: Any extension is supported, `.fun` is the convention\n- **Directory traversal**: `../../shared/helpers`\n\n#### Module Structure\n\nA module file can contain:\n- **Function definitions**: `inc = \\x -\u003e x + 1`\n- **Type annotations**: `factorial : Lam\u003cInt, Int\u003e`\n- **Import statements**: `import other from \\`./other\\``\n- **Export record**: The final expression is exported\n\n```fun\n# math.fun - a more complex module\nimport lib from `./lib`\n\n# Type annotations\nfactorial : Lam\u003cInt, Int\u003e\nfactorial = \\n -\u003e when n == 0 is\n    True -\u003e 1;\n    False -\u003e n * factorial(lib.dec(n))\n\n# Export multiple functions\n{\n    factorial: factorial,\n    inc: lib.inc,\n    dec: lib.dec\n}\n```\n\n## Built-in Functions\n\n- `+` : Addition for integers\n- `-` : Subtraction for integers  \n- `==` : Equality comparison\n- `fix` : Fixed-point combinator for recursion\n\n## Development\n\n### Project Structure\n\n```\nfun/\n├── main.go              # Main executable\n├── internal/            # Core language implementation\n│   ├── program.go       # Program execution\n│   ├── expr.go          # Expression AST\n│   ├── type.go          # Type system\n│   ├── value.go         # Runtime values\n│   ├── env.go           # Environment management\n│   └── lsp.go           # Language Server Protocol\n├── tree-sitter-fun/     # Parser implementation\n│   ├── grammar.js       # Tree-sitter grammar\n│   └── bindings/        # Language bindings\n├── examples/            # Example programs\n└── vscode/              # VS Code extension\n```\n\n### Building\n\n```bash\n# Build main executable\ngo build\n\n# Build tree-sitter parser\ncd tree-sitter-fun\nnpm install\nnpx tree-sitter generate\n```\n\n### Testing\n\n```bash\n# Run tree-sitter tests\ncd tree-sitter-fun\nnpx tree-sitter test\n\n# Run Go tests\ngo test ./...\n```\n\n## IDE Support\n\n### VS Code Extension\n\nThe project includes a VS Code extension with:\n\n- Syntax highlighting\n- Language Server Protocol support\n- Code completion\n- Hover information\n\nTo install the extension:\n\n1. Build the main executable\n2. Open the `vscode` folder in VS Code\n3. Press F5 to run the extension\n\n### Language Server\n\nThe LSP server provides:\n\n- Syntax error reporting\n- Type information on hover\n- Code completion suggestions\n- Go-to-definition support\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests\n5. Submit a pull request\n\n## Author\n\nMatan Tsuberi \u003ctsuberim@gmail.com\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsuberim%2Ffun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsuberim%2Ffun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsuberim%2Ffun/lists"}