Gren 0.4: New Foundations
gren-lang.org
gren-lang.org
IIUC, Roc is what you get if you stir together:
- I like Elm, and wish I could use it in other domains - I have a bunch of ideas for where Elm could go, but I don't want to mess with Elm - A really smart, incredibly thoughtful BDFN (benevolent dictator for now)
If the answer is "use Elm", then I guess that's fine, but that answer needs to be in the FAQ.
I also find it a weird answer honestly. Having two such similar languages for frontend and backend, but without being able to share code seems weird.
https://gren-lang.org/book/appendix/faq/#what-are-the-differ...
IMHO it should be more prominent on the hope page or the elevator pitch.
There is also a cottage industry of applications in elm that don’t target the browser like elm-review, and applications running elm code without using its js output, like elm-test-rs. These are made possible by the relative simplicity of elm’s syntax and semantics, which mean getting a workable ast is easy.
Gren isn't compatible, and will never be compatible, with Elm. There is different syntax, API's and runtime characteristics. And it will continue to diverge more and more.
That Gren is a fork, was mostly to save development time. You can expect that much of the compiler and core packages to be rewritten in a few years.
(I sure don't miss the constant breakage)
Practically, it’s abandoned.
I use Elm in production and am quite happy with it. Abandoned or not doesn't seem like an issue in practice.
https://package.elm-lang.org/packages/elm/json/latest/ https://package.elm-lang.org/packages/elm/http/latest/Http
Their solution is, uhm, to wait until JSON disappears and the problem fixes itself, I kid you not: https://gist.github.com/evancz/1c5f2cf34939336ecb79b97bb89d9...
"Parse API-produced JSON as a contract" is exactly the kind of programming problem pure functional languages were supposed to solve.
And we're building horrific and error-prone rube-goldberg machines to bolt onto our functional programming languages instead.
You literally make no sense to me. Are you sure we are talking about the same thing?
I mean sure: writing JSON parsers takes time, but once written they are awesome.
The promise of pure functional programming was to never write a 'JSON parser' by hand ever again. (Among other things.)
The paradigm failed because people in charge of Haskell and Elm and other similar languages failed at their job.
What we do, is leave this up to generated code. We have OpenAPIv3 specs for our APIs and we use the OpenAPIv3-Elm-client-generator to generate the client so we do not deal with JSON parsing etc. ourselves.
I don't know what you mean by "defeats the point of using Elm in the first place", what is the point, and how is it defeated?
If anything, since using Elm I trend towards using things like io-ts or zod to replicate it when I'm working with TypeScript because it is so much better to get that consistency and validation.
(I’m a big fan of MLs so this is a genuine question!)
My main worry about pure functional languages is that you are at the mercy of the compiler for optimization - for better or for worse. In OCaml or F# I can hand-write things in an imperative way on hot paths. This still doesn’t prevent OCaml from having great optimization passes.
Elm numbers are JavaScript numbers, so divide by zero returns NaN, it doesn't crash.
Although there are other instances that definetly can crash your program, Elm code doesn't allow you to throw or catch exceptions as a language feature.
> My main worry about pure functional languages is that you are at the mercy of the compiler for optimization
It's a scale. There are many ways to optimize outside of using mutation, and allowing for imperative code does prevent certain kinds of optimizations. In general though, the trade off with a language like Gren is that you value correctness and readability more than performance. For me, for the sort of projects I work on, I've never hit an unsolvable performance problem with a pure language. Your milage may vary.
Today, you use + for numbers, and ++ to concatenate strings and list.
1. Improve FFI (aka Elm Kernel for everyone) 2. Support Self hosted packages 3. Implement LSP for better IDE integration?
Im cautiously optimistic about Gren, and hopefully some of these concerns can be addressed.
2. Yes. Most of the pieces are implemented already, and we support local dependencies (as in, depend on a package on your local disk). We "just" need to figure out how to represent a remote repo in gren.json (easy) and what to do with name collisions (less easy).
3. Yes. Gren-in-Gren is currently underway. Once the parser is re-written, it will be made available as a package. This means it should be easy for anyone to write an LSP, formatter, linter etc. But it wouldn't surprise me if LSP becomes integrated with the compiler.
* Compile to WASM
* Parametric modules (OCaml functors)
* Structural (as opposed to nominal) unions
* Improvements to the Ports (FFI) mechanism while still retaining purity
* Actors(?)
* Support more builtin Browser and NodeJS APIs out of the box
The big thing with Gren is that it's easy to anticipate what your code will do, even when calling functions you don't know the implementation of. It's hard to do this when function calls can mutate state, throw unchecked exceptions or perform arbitrary and unmanaged side effects.
Gren tries to do without these (mutation, unchecked exceptions, unmanaged side-effects) without requiring too much effort on the developer's part. In return, you can easier reason about the behaviour of your program.
Elm proved, at least to me, that this was good way to write programs. Gren simply tries to take it a step further by including first class support for backend applications and command line tools through NodeJS.
Thank you for your efforts by the way!
Gren targets JS and Roc targets native.