Live data from Hacker News

Frege: A JVM pure functional programming language in the spirit of Haskell

github.com

41–50 of 112 posts

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#41
post #36

Earlier quoted context omitted.

Android doesn't run JVM.

Not technically, but practically speaking, you compile to JVM code & then it gets translated. This makes targeting the JVM & Android trivial.

It's not trivial, this is why there are no JVM languages that really run well on Android.

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#42
post #24

Earlier quoted context omitted.

A runtime that can be used for a wide-variety of types of applications. JVM can really only be used for writing web servers and possibly daemons.

And building Twitter [1], and big-data next-generation databases [2], and android apps, and desktop apps, and big data [3], and as a platform for new languages (Clojure, Scala, Frege), and many more applications. Really, the JVM can be used for anything that _computers_ can be used for, and it does so in a way that the code is runnable across all major platforms and still maintains a top-5 language performance spot,…

> And building Twitter [1],

Web server.

> and big-data next-generation databases [2]

Daemon.

> and android apps

No, Android doesn't have a JVM.

> and desktop apps

If you say so, I see very few of these in production.

> and big data

Daemon.

> Why do you feel that the JVM is limited in its applications as a development platform?

You can't write cli applications in a JVM language because the start-up time is too slow. Which means you can't compose scripts that call Java apps.

This is not just 1 type of application, it's the most important type of application by far. It's fundamental to how Unix operates. With Java you can't write small applications that do one thing well, you have to write big applications that are going to run for a very long time.

This is useful for things like web servers and daemons, but otherwise it sucks. It's why I can't get excited about JVM languages.

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#43

Earlier quoted context omitted.

I'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.

Why not F#?

A good question, remember Don Syme and Simon Peyton Jones even work in the same building...

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#44
post #36

Earlier quoted context omitted.

Android doesn't run JVM.

Not technically, but practically speaking, you compile to JVM code & then it gets translated. This makes targeting the JVM & Android trivial.

Runtime code generation doesn't work on Android. This means all the reverse dependencies of cglib, for example. That is huge part of JVM ecosystem.

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#45
post #35

Anything that replaces the horribly overengineered and bastardized Scala travesty is welcome.

One 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.

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#46
It'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

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.

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#47
post #34

Earlier quoted context omitted.

Your comment would be more useful if you elaborated on these claims.

The 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 blockin…

There are at least two JVM lightweight thread libraries. Kilim [1] and Quasar[2] (written mostly by me).

[1]: http://www.malhar.net/sriram/kilim/

[2]: http://puniverse.github.io/quasar/

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#48

Earlier quoted context omitted.

I'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.

Why not F#?

I'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?)

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#49
post #42

Earlier quoted context omitted.

And building Twitter [1], and big-data next-generation databases [2], and android apps, and desktop apps, and big data [3], and as a platform for new languages (Clojure, Scala, Frege), and many more applications. Really, the JVM can be used for anything that _computers_ can be used for, and it does so in a way that the code is runnable across all major platforms and still maintains a top-5 language performance spot,…

> And building Twitter [1], Web server. > and big-data next-generation databases [2] Daemon. > and android apps No, Android doesn't have a JVM. > and desktop apps If you say so, I see very few of these in production. > and big data Daemon. > Why do you feel that the JVM is limited in its applications as a development platform? You can't write cli applications in a JVM language because the start-up time is too slow. W…

> You can't write cli applications in a JVM language because the start-up time is too slow. Which means you can't compose scripts that call Java apps.

You're right. In the case of small, fast applications designed to be called as part of shell scripts, the JVM does suffer start-up costs. Some testing on my personal machine shows the JVM to be 2x to 8x slower than a comparable Ruby or Python script in startup time. [1] Depending on the script, that startup time may or may not acceptable, and if the script runs for longer than a second, which is entirely possible for anything that goes beyond the local machine, the JVM will get progressively faster.

> This is not just 1 type of application, it's the most important type of application by far.

This needs more explanation. I've used Unix for many years, and I've definitely bought in to its philosophy of small and composable; It's a philosophy that in many ways mirrors functional programming. However, in my opinion, the most important type of application varies considerably by person. For you, the small, single-purpose applications may be what you use most.

And I agree, if you're programming for the Unix platform, the JVM would not be the best choice. Unix was built on C. A program that builds on that platform is probably a better choice.

But there are many more applications out there, and for any command-line program that operate in a time domain longer than 10 seconds, the JVM startup costs are mostly eliminated. This time-domain is very plausible for a command that operates on medium-scale databases or anything with network connectivity.

It's silly to completely dismiss an entire platform because it is not the absolute best choice for a single domain of programs.

I'm curious: What do you do where the short-lived, composable Unix functions are the most important programs?

[1] https://gist.github.com/bostwick/8ee1d4df9c7743f9efed

Re: Frege: A JVM pure functional programming language in the spirit of Haskell

#50

Earlier quoted context omitted.

Why not F#?

I'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?)

It 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.
Post reply on HN