{"id":13609900,"url":"https://github.com/Frege/frege","last_synced_at":"2025-04-12T22:32:09.565Z","repository":{"id":4833121,"uuid":"5987163","full_name":"Frege/frege","owner":"Frege","description":"Frege is a Haskell for the JVM. It brings purely functional programing to the Java platform.","archived":false,"fork":false,"pushed_at":"2025-03-01T13:33:02.000Z","size":104400,"stargazers_count":3647,"open_issues_count":46,"forks_count":145,"subscribers_count":153,"default_branch":"master","last_synced_at":"2025-04-06T08:00:39.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/Frege/frege/wiki/_pages","language":"Frege","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rest-client/rest-client","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frege.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2012-09-27T19:06:24.000Z","updated_at":"2025-03-29T11:22:00.000Z","dependencies_parsed_at":"2025-03-30T07:01:41.775Z","dependency_job_id":"7af1dfe6-1cd2-4d15-adf5-2c8bb880c44e","html_url":"https://github.com/Frege/frege","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frege%2Ffrege","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frege%2Ffrege/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frege%2Ffrege/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frege%2Ffrege/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frege","download_url":"https://codeload.github.com/Frege/frege/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248640857,"owners_count":21138104,"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":[],"created_at":"2024-08-01T19:01:39.098Z","updated_at":"2025-04-12T22:32:09.558Z","avatar_url":"https://github.com/Frege.png","language":"Frege","readme":"What is Frege? \n==============\n\n[![Build Status](https://travis-ci.org/Frege/frege.svg)](https://travis-ci.org/Frege/frege)\n[![Join the chat at https://gitter.im/Frege/frege](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Frege/frege?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) **Winner of the JavaOne Emerging Languages Bowl 2015, 2016, 2017**\n\n\u003cimg width=\"450\" height=\"450\" src=\"resources/Frege_logo.png\"/\u003e\n\nFrege is a Haskell for the JVM.\n\nLike any Haskell, it is purely functional, \nenjoys a strong static type system with global type inference and\n[non-strict](http://en.wikipedia.org/wiki/Non-strict_programming_language) - also known as _lazy_ - evaluation.\n\nFrege compiles to Java, runs on the JVM, and uses any Java library you want. \nIt can be used inside any Java project.\n\nA Taste of Frege\n----------------\n\n**1. Hello World**\n\nThis is the classic starter with a slight extension to show the fluent usage from Java and the benefits\nof having a type system that can recognize purity.\n\n```frege\nmodule Hello where\n\ngreeting friend = \"Hello, \" ++ friend ++ \"!\"\n\nmain args = do\n    println (greeting \"World\")\n```\n\nThis code will compile to `Hello.class` and `Hello.java` with a regular Java `main` method that one can start the usual Java way.\n\nMoreover, the `Hello.class` will have a method\n\n    public static String greeting(String ...) {...}\n\nthat one can call from Java or any other JVM language.\n\nThe `greeting` function is **pure**, meaning it is _stateless_ and _free of side effects_.\nTherefore, it is _threadsafe_ and its results may be _automatically cached_ since given the same argument, the result will always be the same.\n\nThe `main` function is **impure**. It takes a list of `String`s and does not return just \"void\" as in most other JVM languages but the\ntype `IO ()`, telling that it may produce side effects like printing to the console. The Frege **type system** guarantees\nthat any caller of `main` must also be of some `IO` type and is thus also marked as impure. That way, the lack of purity percolates up the whole call chain.\n\n\"Hello World\" already shows the tenet of _\"islands of purity\"_ (greeting) in a _\"sea of imperative code\"_ (main).\n\nSince the purity information is carried through the **type system**, the compiler can potentially use it for many\n**optimizations** such as pre-calculation, deferred execution, parallel execution, caching, and elimination of common subexpressions.\n\n\u003e Frege is **strongly** and **statically** typed, even though we haven't declared any types in the code above.\n\u003e If not declared, the types are _inferred_. When declared, the given types are checked against the inferred ones.\n\n**2. Expressive code**\n\nMuch can be achieved in Frege in one line of code and here is an example that you can paste into the\n[Online REPL](http://try.fregelang.org/). It calculates [pythagorean triples](https://en.wikipedia.org/wiki/Pythagorean_triple) below `10` with the help of a list comprehension:\n\n    [ (x,y,z) | x \u003c- [1..10], y \u003c- [x..10], z \u003c- [x..10], x*x + y*y == z*z ]\n    \nAfter execution, you should see a list of triples containing the solutions `(3, 4, 5)` and `(6, 8, 10)`. \n    \nSuch a comprehension reads almost like an SQL statement: \n* _select_ the triple `(x,y,z)`\n* with `x` drawn _from_ the list of `1` to `10`, `y` from `x` to `10`, and `z` from `x` to `10`\n* _where_ `x*x + y*y == z*z`\n\n\u003e There are much more elegant and efficient ways to calculate the triples, but those are a bit less obvious.\n\n**3. No mutable state**\n\nMutable state is the source of many bugs and makes code less modular. \nFrege allows interesting ways to avoid it.\nThat style is very unfamiliar to many developers that come from the imperative world.\nBe brave. It is different but there are a huge benefits to be discovered.\n\nLet's go for a more advanced example where we calculate the fixpoint of the cosine function, i.e. the\nvalue where [`cos(x) == x`](http://www.wolframalpha.com/input/?i=cos+0.7390851332151607).\n\nImplementations in imperative languages usually involve introducing local mutable state. Not so in Frege:\n```frege\nimport frege.prelude.Math (cos)\n\ncosines = iterate cos 1.0\npairsOf xs = zip xs (tail xs)\nhead [ x | (x,y) \u003c- pairsOf cosines, x == y] \n```\nAfter execution, it should show you the value\n\n     0.7390851332151607\n\nThe code is most likely incomprehensible for a Frege/Haskell newcomer at first, but it becomes\nless intimidating once you know the parts. With a bit of experience, you may even find it\nclear and obvious.\n* Again, we have a list comprehension. We get a list of `x` values, but we only need the first element, the `head`.\n* The `x` comes from an `(x,y)` pair where `x == y`.\n* The `(x,y)` pair is drawn from a list of pairs of cosine values.\n* The `cosines` are an _infinite_ list of values that starts with `1.0` and then `iterate`s to `cos(1.0)`, `cos(cos(1.0))`, `cos(cos(cos(1.0)))`, and so forth.\n* Please note that the `=` signs do _not_ denote an assignment but a definition. There are no assignments in Frege!\n* The `pairsOf` function works on any list of values to create pairs of any adjacent values.\nIt uses `zip`, which is an often-used construction for this task, but the details are not relevant here.\n\nThis code is **pure**. The inferred type is `Double`.\nThe code does not rely on any mutable state (not even internally). Therefore it is _threadsafe_ and the result can be _automatically cached_.\n\nWhat's in it for me?\n--------------------\n\n**For the Java programmer**\n\nFrege offers you the opportunity to **learn and use a new programming paradigm**\nthat shines with\n* a solid mathematical foundation,\n* **pure** functions,\n* **immutability** by default,\n* side-effects only when declared,\n* **robustness** under composition and concurrency,\n* and a **type system** that is unparalleled on the JVM with its combination of power, simplicity and expressiveness.\n\nYou can still reuse your existing knowledge of the Java platform and its vast set of libraries.\nFrege interoperates with Java such that you can easily\n[call Frege from Java code](https://github.com/Frege/frege/wiki/Calling-Frege-Code-from-Java) and vice versa.\nBut unlike other approaches,\n[calling Java from Frege](http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/)\ndoesn't undermine the language guarantees.\n\n\u003e When calling Java from Frege, you have to declare the Java types in rigid Frege terms in order to\n\u003e preserve the Haskell language characteristics, especially purity, thread safety, and lazy evaluation.\n\nLearning Frege essentially means that **you will also learn Haskell** and thus your effort pays off twice, since\nyou also get to know a very popular non-JVM language with 25+ years of development, a great community,\nmany (free) books, publications, tutorials, online courses, and considerable industry demand.\n\n\n**For the Haskell programmer**\n\nFrege gives you the opportunity to **use your skills on the JVM**.\nMost idiomatic Haskell code will run in Frege unmodified or with only minimal, obvious adaptations.\nEven more important: you can bring your purely functional solution strategies to your Java projects.\n\nFrom now on you can also enjoy on the JVM:\n* the terse Haskell syntax\n* pure functions and lambdas\n* algebraic data types and **typeclasses** with parametric polymorphism\n* powerful type inference\n* **higher rank types**\n* lazy evaluation on infinite data structures\n* pattern matching, list comprehensions, do-notation, point-free style, operators, modules\n* functors, monoids, semigroups, monads, and all your other beloved mathematical abstractions.\n\nFrege aims at compiling most \"vanilla\" Haskell code that has no external dependencies \"as is\"\nor with only minimal, obvious changes. Likewise, Frege code that makes no use of JVM specifics should\neasily run through other Haskell compilers. We are currently in the progress of coming closer to this goal\nby ironing out insubstantial differences. \n\nThe Name\n--------\n\nThe Frege programming language is named after and in honor of Gottlob Frege\nwho published the ideas of higher-order functions, partial function application, and many more concepts of formal logic\nthat we now take for granted back in the 19th century.\n\nIf you are curious how this name is pronounced, [you can use this translator page](http://translate.google.de/#de/en/Frege) to get it right.\nJust click the audio symbol in the left (german) part.\n\nProject State\n-------------\n\nThe compiler, an Eclipse plugin, and a provisional version of the documentation can be [downloaded](https://github.com/Frege/frege/releases). \nNote that Frege requires at least JDK 7 to compile and run programs.\n\nA number of tools are **written in Frege**:\n* the Frege compiler itself,\n* the Frege [standard library]( http://www.frege-lang.org/doc/frege/Prelude.html),\n* the Frege [command-line REPL](https://github.com/Frege/frege-repl),\n* the Frege web-based, full-stack [interactive online REPL](http://try.fregelang.org/),\n* the [FregeFX REPL](https://github.com/Dierk/frepl-gui/blob/master/README.adoc) - a JavaFX view on the REPL,\n* the Frege [Eclipse plugin](https://github.com/Frege/eclipse-plugin), the [VS Code Plugin](https://github.com/Frege/frege/wiki/VS-Code)\n* and the documentation tool.\n\nThis should speak for itself regarding stability, functional completeness and performance of the language.\n\nThe documentation is provisional, and the library supports almost all of the Haskell 2010 standard library\nwith the remaining [known differences](https://github.com/Frege/frege/wiki/Differences-between-Frege-and-Haskell)\nbeing there for good reason.\n\nSee the [Getting Started](https://github.com/Frege/frege/wiki/Getting-Started) page for \ngetting started at the command-line or read the [Eclipse plugin](https://github.com/Frege/eclipse-plugin) page.\nThere is a [Frege language server](https://dierk.github.io/Home/data/ip8_report_final.pdf) with multiple plugin options, including VS Code. \nYou can develop [Frege inside Intellij IDEA](https://github.com/Frege/frege/wiki/Using-Frege-in-Intellij-IDEA) with an\nIntellj IDEA plugin being under [development](https://github.com/psurkov/intellij-frege)\nand there is build automation support for\nMaven, Gradle, Leiningen, SBT, and Bazel.\n\nThe documentation tool and the awesome QuickCheck library for advanced unit testing comes bundled with the language.\n\nRelated Projects\n----------------\n\n* [Hoogle for Frege (currently disabled due to domain issues)](http://hoogle.haskell.org:8081/), a Frege API search engine, by Neil Mitchell and Marimuthu Madasamy\n* The REPL projects, consisting of [core JSR 223 scripting support](https://github.com/Frege/frege-interpreter), [interface for the command-line](https://github.com/Frege/frege-repl) and [online REPL](http://try.fregelang.org), all written and maintained by Marimuthu Madasamy, and the [FregeFX REPL](https://github.com/Dierk/frepl-gui/blob/master/README.adoc) with a JavaFX view by Dierk König\n* Support for [web applications and web services](https://github.com/Frege/frege/wiki/Frege-for-Web-Applications) \n* [Maven Compiler Plugin for the Frege language](https://github.com/Frege/frege-maven-plugin), by Mark Derricut \n* [Frege compiler/library as an OSGi bundle](https://github.com/talios/frege-bundle), by Mark Derricut \n* [Apache Maven Tile for the Frege Programming Language](https://github.com/talios/frege-maven-tile), by Mark Derricut\n* [A Leiningen plugin to compile Frege code](https://github.com/Frege/frege-lein-plugin), by Sean Corfield\n* [Gradle Frege plugin](https://github.com/Frege/frege-gradle-plugin), by Mark Perry and Dierk König\n* [Real World Frege](https://github.com/Dierk/Real_World_Frege/), by Dierk König\n* [sbt Frege plugin](https://github.com/earldouglas/sbt-frege), by James Douglas\n* [An efficient Frege Ray-Tracer](https://github.com/mchav/Frege-RayTracer), by Michael Chavinda\n* [Frege Chat](https://github.com/Dierk/FregeChat), Winner at JavaOne 2016 language competition, Dierk König\n* [ProB Parser Library](https://github.com/bendisposto/probparsers) by Markus Brenneis (@mabre) and Jens Bendisposto (editor), University Düsseldorf\n* [Conduit in Frege](https://github.com/matil019/frege-conduit) a port of the Haskell conduit library.\n* [Advanced property-based testing](https://dierk.github.io/Home/data/Frege_Advanced_PBT.pdf) as explored at the [FHNW](https://fhnw.ch).\n\n\nContributions\n-------------\n\nIf you are interested in contributing, here are some hot topics:\n\n* Write Frege code to support more of the Java API.\n* Port Haskell [libraries](https://github.com/Frege/frege/wiki/Libraries) or tools.\n* Open issues in the issue tracker if you find bugs, errors in documentation, etc.\n* [Open issues](https://github.com/Frege/frege-gradle-plugin/issues) in the tooling like [this one](https://github.com/Frege/frege-gradle-plugin/issues/41)\n* Help make Frege popular by writing code for projects like [Rosetta Code](http://rosettacode.org/wiki/Rosetta_Code), or [PLEAC](http://pleac.sourceforge.net).\n* Contribute to the related projects mentioned above, or make your own.\n\nContact\n-------\n\n**Meet Frege friends in person**\n\nTalk to us at any of the [upcoming events](https://github.com/Frege/frege/wiki/Talks)\nor view historic [presentation slides and videos](https://github.com/Frege/frege/wiki/Talks#historic)!\n\n**For discussions**\n\nYou can contact the project members through the\n[discussion group](http://groups.google.com/group/frege-programming-language)\ndevoted to the Frege programming language.\n\n**For questions**\n\nSpecific programming problems are best solved on\n[Stack Overflow](http://stackoverflow.com/questions/tagged/frege),\nwe check questions tagged \"frege\" on a regular basis.\n\n**For casual chat (and quick questions)**\n\nThere's a #frege channel on [Freenode IRC](https://freenode.net) where\nsome project members and Frege users hang out. You can use any IRC client\nyou like or Freenode's [WebChat interface](https://webchat.freenode.net)\nif you don't want to install IRC software.\n\nThe [Frege Gitter channel](https://gitter.im/Frege/frege) is also a way\ntool to connect to the community.\n\n**Staying up to date**\n\n* [YouTube playlist](https://www.youtube.com/watch?v=S-4sYwGY3Sk\u0026list=PL14crhrjkk-lbdn4Yg85_QRk9r_uiX1yh)\n* Facebook: [fregelang](https://www.facebook.com/fregelang)\n* Reddit: [/r/frege](https://www.reddit.com/r/frege)\n\n**For issues only**\n\nIf you find a bug or have an idea for enhancements, please let us know by opening an issue in the\n[issue tracker](https://github.com/Frege/frege/issues).\n(You'll need a GitHub account to do this.)\n_Please keep discussions to the [forum](http://groups.google.com/group/frege-programming-language)\nand questions to [Stack Overflow](http://stackoverflow.com/questions/tagged/frege)._\n\nLinks\n-----\n\n* [Frege Wiki](https://github.com/Frege/frege/wiki/_pages)\n* [Language reference](http://www.frege-lang.org/doc/Language.pdf)\n* [InfoQ Article on Frege's history, current state, and future plans](http://www.infoq.com/news/2015/08/frege-haskell-for-jvm)\n* [edX Functional Programming course FP101x](https://www.edx.org/course/introduction-functional-programming-delftx-fp101x-0) with exercises in Frege\n* Functional Programming [13 videos](https://www.youtube.com/playlist?list=PLoJC20gNfC2gpI7Dl6fg8uj1a-wfnWTH8) by Dr. Erik Meijer\n* [\u003cimg align=\"right\" src=\"https://raw.githubusercontent.com/Dierk/FregeGoodness/master/FregeGoodness.png\"\u003e](http://dierk.gitbooks.io/fregegoodness)Introduction to Frege: [video](https://www.parleys.com/play/543fa326e4b06e1184ae41e6/chapter44/about), [slides](http://de.slideshare.net/Mittie/frege-purely-functional-programming-on-the-jvm)\n* The [Frege Goodness](http://dierk.gitbooks.io/fregegoodness) free ebook \n\nRecommended reading\n\n* [John Hughes: Why functional programming matters](http://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf)\n* [Book: Haskell Programming from first principles](http://haskellbook.com) with [book examples in Frege](https://github.com/elrocqe/frege_programming)\n* [Book: Real-World Haskell](http://book.realworldhaskell.org/read/) (free online)\n* [Book: Learn you a Haskell](http://learnyouahaskell.com/chapters) (free online)\n* [Book: Programming in Haskell](http://www.amazon.com/Programming-Haskell-Graham-Hutton/dp/0521692695/)\n\nAPI Docs\n--------\n\n* [Online Docs (Frege Standard Library)](http://www.frege-lang.org/doc/fregedoc.html)\n* [Online Docs (Runtime Javadoc)](http://www.frege-lang.org/doc/index.html)\n\nCopyright and License\n---------------------\n\nCopyright (c) Ingo Wechsung, 2011-2022. All rights reserved.\nThe use and distribution terms for this software are covered by the\n[BSD 3-clause license](http://opensource.org/licenses/BSD-3-Clause)\nwhich can be found in the file LICENSE.txt at the root of this distribution.\nBy using this software in any fashion, you are agreeing to be bound by the terms of this license.\nYou must not remove this notice, or any other, from this software.\n","funding_links":[],"categories":["Frege","Uncategorized","JVM语言","Libraries","Introduction","Compilers and Interpreters","Languages"],"sub_categories":["Uncategorized","[Java](http://www.oracle.com/technetwork/java/index.html)","Overview","Serious Projects"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrege%2Ffrege","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrege%2Ffrege","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrege%2Ffrege/lists"}