Gren 0.4: New foundations Published: 2024-06-24

Gren is a pure functional programmming language that aims to be easy to learn and to reason about, while remaining powerful and portable enough for real-world use.

The core packages have been updated with new functionality and quality-of-life improvements. The compiler has started its transition from Haskell to Gren. The book has seen a face lift, and Zulip has been replaced by Discord.

Interested? Let's dig in.

New filesystem API

The FileSystem API was functional, but minimal. It has been replaced by three new modules: FileSystem , FileSystem.FileHandle and FileSystem.Path .

FileSystem contains functions for working with the file system.

contains functions for working with the file system. FileSystem.FileHandle allows you to open a file, perform several operations on it and then close it again.

allows you to open a file, perform several operations on it and then close it again. FileSystem.Path gives you a statically typed, cross-platform, representation of a file system path.

Together, these modules give you access to most of the file system operations available in NodeJS.

If you want more information about the new FileSystem API, be sure to watch the video linked above.

Gren-in-Gren

This release contains the first few lines of what will eventually be a ground-up rewrite of the compiler in Gren. While it currently does little more than downloading and executing the Haskell-based compiler, it will eventually enable the use of compiler functionality (parsing, type checking, formatting) in Gren applications.

There are also several indirect benefits of the Gren-in-Gren rewrite, like lowering the barrier of contributing to the compiler, and improving the quality of the Gren core packages by virtue of compiler authors now also being Gren-developers.

In fact, the mentioned rewrite of the FileSystem API is a direct consequence of the compiler needing more functionality than what was previously available.

We'll talk more about the importance of Gren-in-Gren at a later time.

The book has received a face lift

Justin Blake has contributed big changes to the book, which serves as our language guide.

Not only has he filled in empty chapters and added a few new ones, he's also replaced the generator with Astro Starlight. One of the biggest consequences of this change is that you can now search for topics of interest.

We've moved to Discord

Since the very first release of Gren we've been using Zulip to coordinate development of the language. Over time we've received feedback that Zulip might not have been the best choice. Many people feel that they're drowning in communication platforms, so the bar for joining yet another platform is pretty high.

While our experience with Zulip has been good, the future success of Gren depends on an active community. Using the best tool means nothing if we're using it alone.

We've now decided to use Discord for discussing and sharing all things related to Gren. Why don't you join us?

Misc. changes

Using multi-line string syntax for a single-line string is now a compile error.

If the NO_COLOR environment variable is set, color will be stripped from the compiler output.

environment variable is set, color will be stripped from the compiler output. Stream.sendX and Node.exit functions are now Task -based. This makes them easier to compose with other Task s.

and functions are now -based. This makes them easier to compose with other s. You now have access to the location of the current executing program.

You can now set the title of the currently running process.

Removed always , use anonymous functions instead.

, use anonymous functions instead. Bytes now have convenience functions for converting between Bytes and String .

now have convenience functions for converting between and . Bytes.join allow you to build Bytes from Array Bytes . Useful when retrieving several Bytes from HttpClient .

allow you to build from . Useful when retrieving several from . Performance improvements of several Array functions.

functions. Added Array.indexedFold .

. Added several new functions to Dict and Set .

and . Removed Dict.fromArray , use a pipeline of Dict.set or Dict.set in a fold .

, use a pipeline of or in a . Added Task.execute to run a Task without triggering a message to your application's update function.

to run a without triggering a message to your application's function. Added Task.await for imperative-style composition of Task s.

Thank you, contributors

This release was made possible through contributions from the following people: