Gren 0.4: New foundations
Published: 2024-06-24Gren 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.
FileSystemcontains functions for working with the file system.FileSystem.FileHandleallows you to open a file, perform several operations on it and then close it again.FileSystem.Pathgives 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_COLORenvironment variable is set, color will be stripped from the compiler output. Stream.sendXandNode.exitfunctions are nowTask-based. This makes them easier to compose with otherTasks.- 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. Bytesnow have convenience functions for converting betweenBytesandString.Bytes.joinallow you to buildBytesfromArray Bytes. Useful when retrieving severalBytesfromHttpClient.- Performance improvements of several
Arrayfunctions. - Added
Array.indexedFold. - Added several new functions to
DictandSet. - Removed
Dict.fromArray. Use a pipeline ofDict.set, orDict.setin afold. - Added
Task.executeto run aTaskwithout triggering a message to your application'supdatefunction. - Added
Task.awaitfor imperative-style composition ofTasks.
Thank you, contributors
This release was made possible through contributions from the following people:
