12 ms·
Frege: A JVM pure functional programming language in the spirit of Haskell
- bitdiddle 13y agoCute name. I wonder to what extent the language has anything to do with Frege's work in logic. I mean Haskell's last name was Curry, and currying is a big deal in FP. Thankfully that wasn't named after Moses Schoenfinkel.
- mixon 13y agoMaybe it is named after Élodie Frégé (see http://en.wikipedia.org/wiki/%C3%89lodie_Fr%C3%A9g%C3%A9 http://en.wikipedia.org/wiki/%C3%89lodie_Fr%C3%A9g%C3%A9)
- Xophmeister 13y agoThat said, I always felt that "Finkel" would be a cute name for an FP language, service or library... I call dibs!
- chops 13y agoWith its packaging system called Einhorn.
- JasonSage 13y agoIf that's the case, maybe you should name if after Raphael Finkel. [1] Disclaimer: I had the privilege of meeting Dr. Finkel here at university a few times before I stumbled across his name in Wikipedia and in the front of a book in the library. Totally not biased. [1] http://en.wikipedia.org/wiki/Raphael_Finkel http://en.wikipedia.org/wiki/Raphael_Finkel
- guerrilla 13y agoIt very likely does. Also note there's a deep connection between functional programming and logic. http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence http://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspond...
- oggy 13y agoActually, I've heard of German professors who used the word "Schoenfinkeln" instead of "currying". You sometimes get people who try to fight the English influence off at all costs ;)
- tel 13y agoIf you want that in Haskell, there's a package for it http://hackage.haskell.org/package/acme-schoenfinkel http://hackage.haskell.org/package/acme-schoenfinkel
- paf31 13y agoSchoenfinkel was my second choice for a name my compiler project. Not a fan, huh? :)
- chongli 13y agoHey, I'd love to use a language named Moses. You'd have all sorts of great puns and iconography available for library names.
- voxfrege 13y agoThis is easy, Frege is (to my knowledge) the first one who mentions "functions, that take other functions as arguments". In other words: higher order functions.
- nandemo 13y agoLet me introduce you to the legendary Tokyo Schönfinkel Appreciation Club: http://www.cynic.net/tsac.html http://www.cynic.net/tsac.html
- voxfrege 13y agoI hate to say it, but when Schönfinkel Curried, he in fact Freged, as even currying was anticipated by Frege. See here, for example: http://books.google.de/books?id=OeAPiy-6L74C&pg=PA134&lpg=PA134&dq=frege+sch%C3%B6nfinkel&source=bl&ots=RkD3ouu82c&sig=k_Yl9VXGfA5HXI2iZ-J1vbcXBVg&hl=de&sa=X&ei=Fwp9UtGHL-To4QS244CABg&ved=0CFsQ6AEwBQ#v=onepage&q=frege%20sch%C3%B6nfinkel&f=false http://books.google.de/books?id=OeAPiy-6L74C&pg=PA134&lpg=PA...
- deleted 13y ago[deleted]
- reirob 13y ago"Frege is thought as a substitute for this missing GHC port. While not derived from any existing Haskell implementation, it is more or less equivalent to Haskell 2010. Please see the wiki page that details the differences." So now Haskell can produce native executable code, run in a JVM and as subset of it (https://github.com/faylang/fay/wiki https://github.com/faylang/fay/wiki) run in the browser. Now there is no excuse for me to NOT using Haskell ;) Thanks for bringing Haskell to the JVM!
- cordite 13y agoIf you look at the differences page, it is equivalent in power, but does not have the same expression. Pragmas now sorta start with @, and type classes are (in my opinion) kinda funky coming from Haskell.
- cgh 13y agoAnother difference not mentioned is given the use of recursion in Haskell and the JVM's lack of tail-call optimisation, I have to wonder how dangerous this is. I know Clojure has recur (I'm not a Clojure programmer) but unless Frege has something similar, I predict many an exploding stack.
- cgag 13y agohttp://stackoverflow.com/questions/10008673/does-frege-perform-tail-call-optimization http://stackoverflow.com/questions/10008673/does-frege-perfo...
- dustingetz 13y agoIt can compile to a loop. JVM can't optimize it for free at runtime. Scala has tail recursion elimination
- anonymoushn 13y agoPlease, scalac performs TCO in fewer cases than g++. Some JVMs are able to perform TCO, which is nice since scalac won't do it.
- stuhood 13y agoThe conclusions of http://fregepl.blogspot.jp/2013/03/adding-concurrency-to-frege-part-iii.html http://fregepl.blogspot.jp/2013/03/adding-concurrency-to-fre... lead me to believe that the author knows significantly more about Haskell than about either the JVM or concurrency. I hope that the language is able to attract a healthy number of contributors in those areas before it begins to accrete it's own idiomatic concurrency patterns.
- noelwelsh 13y agoYour comment would be more useful if you elaborated on these claims.
- stuhood 13y agoThe section on forkIO vs forkOS is interesting because the author does not mention implementing green threads atop the JVM. It would be feasible for Frege and its core libraries to use an implementation of "green threads" based on Promises or CPS under the covers in order to implement a concurrency model indistinguishable from Haskell's. While it is true that the vast majority of JVM code you interact with is blocking and expects to own whatever OS thread it is running on, that could be treated as a concern of FFI, where untrusted/blocking code in Java land gets dedicated OS threads (similar to FuturePools/execution-contexts for scala Futures, or how you would manually isolate blocking code for Erlang or Go FFI.) Additionally, the comment dismissing STM seems like an afterthought, because there are at least three JVM implementations (Clojure's, Scala's, and Multiverse) But the main comment I was referring to was: To do serious concurrent work in an JVM environment is different and it will thus require different knowledge ... which suggests that the author isn't interested in supporting Haskell's idiomatic concurrency model atop the JVM, and is instead fine with the status quo of blocking code.
- pron 13y agoThere are at least two JVM lightweight thread libraries. Kilim [1] and Quasar[2] (written mostly by me). [1]: http://www.malhar.net/sriram/kilim/ http://www.malhar.net/sriram/kilim/ [2]: http://puniverse.github.io/quasar/ http://puniverse.github.io/quasar/
- binarymax 13y agoI'm excited about this - but cannot seem to find a 'hello world' or any other actual code examples? --Edit-- is it the exact same syntax as Haskell? Unclear.
- quesebifurcan 13y agohave a look at: https://github.com/Frege/frege/tree/master/examples https://github.com/Frege/frege/tree/master/examples
- tel 13y agoIt's cousin syntax, very close but not identical.
- reirob 13y agoA presentation about Frege from the author itself: http://fregepl.blogspot.jp/2013/08/talk-at-karlsruhe-functional.html http://fregepl.blogspot.jp/2013/08/talk-at-karlsruhe-functio... Actually it is the link to the blog entry that contains a link to the presentation.
- Touche 13y agoLooks really cool! Oh, it runs on the JVM. Hm, too bad.
- waterlion 13y agoWhat would you prefer? A language that doesn't need a runtime, like C? A language that has only one available runtime, like node.js? A language that has a choice of runtimes but there are incompatibilities between them like Python or Ruby? A language that has a choice of runtimes from a choice of vendors like Java?
- tomkludy 13y agoI'd like something running on the CLR. Not because I think the CLR is very special; just because I really like Haskell but I have to work within a large ecosystem of existing .NET code.
- callmecosmas 13y agoWhy not F#?
- pacaro 13y agoA good question, remember Don Syme and Simon Peyton Jones even work in the same building...
- tomkludy 13y agoI've been playing with it some. It's nice, but I still prefer Haskell. I want to be able to separate pure from impure code, but F# doesn't seem to enforce that. (Unless I'm missing something?)
- Touche 13y agoIt doesn't. In fact, F# feels like it started off as a fairly pure functional language but some Microsoft PM said "it has to support every API in .NET" and so a lot of OOP stuff was bolted on the side. It feels like 2 different worlds in one language. You can easily get by never using the impure stuff but it's still there, taking up space.
- Tyr42 13y agoI like some of the differences where it was not constrained by Haskell's choices, like splitting up the Monad, Applicative, Functor instances, and namespacing of accessors. I also quite like the • for compose, with then some shims so that . works too if it's not being used for the namespacing.
- anon_d 13y agoYeah, I'd like to see more languages using unicode identifiers. Seems to be a very unpopular approach, though :(
- tikhonj 13y agoHaskell can do it: there's a library with common Unicode operators[1] (including ∘ for function composition) and an extension allowing you to use Unicode syntax[2] (things like → in place of ->). I've seen these things used, but they're not super common. People still worry about not being able to input Unicode symbols in their editor! I personally think this is absurd in this day and age. Naturally, it's very easy to do in Emacs; somebody even wrote a Haskell input mode[3]. [1]: http://hackage.haskell.org/package/base-unicode-symbols-0.2.2.4/docs/Prelude-Unicode.html http://hackage.haskell.org/package/base-unicode-symbols-0.2.... [2]: http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/syntax-extns.html http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/synta... [3]: https://github.com/roelvandijk/emacs-haskell-unicode-input-method https://github.com/roelvandijk/emacs-haskell-unicode-input-m...
- anon_d 13y agoOh, nice! I setup XCompose to support rfc1345, so I have fast unicode input everywhere. I'm definitely going to experiment with that Haskell extension. I've done that manually before in ML with a preprocessor, but it was a nasty hack. A proper extension is much nicer! EDIT: How many people still have trouble with Unicode input? Should I publish my XCompose solution?
- voxfrege 13y agoIt turned out that porting Haskell code was a nightmare when the (.) did not work yet. (You can't just replace each . with • unless you don't have any qualifed names.) Today, it can be quite easy, in the best case you just Ctrl-C Ctrl-V
- rtfm666 13y agosimplified one here too - https://github.com/lwm/functional-java/blob/master/src/test/nonStrict/HigherOrderTest.java https://github.com/lwm/functional-java/blob/master/src/test/...
- _pmf_ 13y agoAnything that replaces the horribly overengineered and bastardized Scala travesty is welcome.
- pron 13y agoOne of the things that make the JVM so cool is the easy interoperability of most JVM languages. It's good to have languages like Java (or Kotlin), Clojure, Frege and Erjang on the JVM, each with its own strengths. Each can remain relatively simple and consistent, and all interoperate and share libraries. This is far better than that "bastardized travesty" trying to be all languages at once, and ending up an incoherent mess, retaining little of the advantages of those simple languages.
- allertonm 13y agoIt's interesting to compare this to CAL - an earlier Haskell-like language on the JVM that was a project of some of my former colleagues at Crystal Decisions/Business Objects back in the 00's: http://openquark.org/Welcome.html http://openquark.org/Welcome.html I've worked quite a bit with CAL over the years and it has been used for some serious work. One of my big frustrations with it though has been the clunkiness of the Java interop, especially since this is one of the reasons you might choose to use a language on the JVM. Looking at the Frege docs, I like the look of the way this has been handled - rather than using an FFI-style approach, things like Int, String etc map directly to Java types and Java classes can be used like ADTs, which would make life way, way easier. Given the nature of the language calling Frege from Java is always going to be more complicated but it looks like they've done a nice "fluent" Java API for calling into the runtime. Would be interesting to see how this performs relative to CAL, in terms of both speed and space.
- voxfrege 13y ago> Would be interesting to see how this performs relative to CAL, in terms of both speed and space. Indeed. Do you have some CAL installation somewhere to make a comparison? (The links I find are all broken.)
- allertonm 13y agoUnfortunately it looks like you would have to build from source. The best place for that would be Rich Webster's fork - https://github.com/rdwebster/Open-Quark https://github.com/rdwebster/Open-Quark - which is the version maintained by Indicee.
- deleted 13y ago[deleted]
- tieTYT 13y agoAs a programmer who's getting annoyed and tired of Java's boilerplate, I welcome this. I went from Haskell to Clojure to JavaScript. I loved Haskell the language. What I don't is third party libraries are usually directly or indirectly (through a dependency) tied to an OS. I've heard, even on irc's #haskell, that it's hard to reuse code unless you're on linux. Coming from Java, this is a deal breaker for me. Then I tried Clojure. I liked it, but I found it very challenging to refactor and mentally debug my code. I missed all the benefits of static typing. core.typed seemed like an answer, but when you compare it to other languages it seems to triple the verbosity which is a real turn off. JavaScript (via CoffeeScript) is a pretty good middle ground, but immutable state is nearly impossible. If I get lazy, it's so easy to go back to a OO/procedural style and I don't like that. That probably does have its benefits, but not when you're trying to learn a new programming paradigm. I know very little about Scala, but I get a terrible impression from it. Where Clojure is about simplicity, Scala seems to be about complexity. Since I learned Haskell, I wished there was a way I could use it and have it "just work" when I decide to use a library. Frege may be the answer. I've heard of it a long time ago. My concern is that I'd be 1 of 3 people who'd be using it. But nothing's perfect.
- cgag 13y agoI'm confused as to how javascript is a good middle ground. What does it give you that Clojure doesn't? You do mention the fact that it encourages imperative code and loses immutability. How does it improve refactoring or debugging?
- tieTYT 13y agoThat's a fair question and I don't understand it myself. Perhaps it's because the Firefox/Chrome dev tools are so useful. Perhaps its because I understand what the errors are trying to tell me. In JS I usually have a good mental model of the data I'm dealing with. I didn't have that with Clojure. I didn't have it in Haskell either, but the Haskell compiler would immediately get in my face about it until I fixed it.
- voxfrege 13y ago> My concern is that I'd be 1 of 3 people who'd be using it. This concern is probably well founded. :) And yet. Remember, you get Java source code from the Frege compiler, and once you pack up your JAR with Proguard, say, nobody will be able to tell you didn't write it in Java. (Well, slightly exaggerated, but you could have used some obscure library, who knows?) So, if you have a small project, or some Haskell project without too many GHC extensions you want for some reason on the JVM, give it a try.
- adultSwim 13y agoI really wish this was strict. I feel like most regular programmers could understand and benefit from using ML (or some similar language). In Haskell, laziness kept the language pure while it was developing but now I'm not sure it should be the default. I like OCaml style opt in laziness. For most people, they could get a lot of pretty vanilla typed functional programming language. Polymorphic type inference, algebraic data-types, pattern matching. That gets you really far.
- cannam 13y agoThere is Yeti (http://mth.github.io/yeti/ http://mth.github.io/yeti/), a JVM language from the ML family. I think it's close to a 1.0 release, and the compiler has been pretty reliable for a while now. I find it a delight to use.
- undoware 13y agoAs an analytic phil PhD dropout and a Haskell lover I can say with confidence that (a) Gottlob Frege (the philosopher) was awesome (I still want a 'morning star != evening star' tattoo) and (b) Frege sounds lovely too. I'd actually considered writing something similar.
- lysium 13y agoThe author Ingo Wechsung outlines the ideas and concepts of Frege in the German blog 'Funktionale Programmierung': http://funktionale-programmierung.de/2013/10/10/frege.html http://funktionale-programmierung.de/2013/10/10/frege.html