The Unison ecosystem has been a hive of activity lately! After the launch of Unison projects, we've seen a number of new libraries materialize. Naturally, we took this as an opportunity to make fun things! Check out the demos and code snippets below. We hope this ecosystem synopsis inspires you to do the same.
Hotswapping Unison code
Inspiration struck Unison contributor @dfreeman in the form of an offhand feature request in Unison's community slack. The nerd-sniping worked and now we have a library for live-updating Unison code as it's running. π€― It might have been a speculative idea at the time, but the result is Hotswap: a library that enables you to record "placeholder" values in your program and then update them live during the program's runtime.
The docs for this library are fantastic π€ so you can follow along with how the library was implemented, understand the caveats for using hot-swapping, and dream up new use cases.
Json Schema
Thanks to community member @chuwy, Unison has a libray that can model, derive, and validate Json Schemas. For folks who have never used Json Schemas, they're a way to describe the shape of a Json document and whew... the schema specification is vast π ! We're very grateful to have @chuwy's expertise at work in authoring this library. π
Routes
Unison has a new abilities-based library for defining server routes. As you're writing Unison web apps, you can use the Routes library to define how your application should respond if a given route is matched.
Here's what defining routes looks like:
At the edge of your program, you can combine all of your routes together and serve them on a port.
Midi Sequencer
Take a look at the ever expanding universe that is Alvaro's project list, and you'll find a new library called Sequencer for interacting with the MIDI protocol. Sequencer enables you to write Unison programs for playing music on Midi devices.
You know what that means...
If you would like to join the Unison command line band, pull the project here or write something brand new using the Sequencer library.
Terminus
Runar's terminal library is going to radically increase the amount of time you spend playing command line games while your non-Unison code compiles.
Terminus provides a set of functions for interacting with the terminal, including the ability to write text to the screen, read input from the user, and store, move, or reset the cursor at different screen locations.
TLS simple
TLS primitives have existed in Unison's standard lib for a while, but @runarorama recently added a library that makes it easier to send encrypted messages over a secure channel in Unison. The TLS library is build atop a new TCP server library, also authored by Runar. Rather than managing TCP sockets yourself, you can use more ergonomic functions like Tls.serve
and Tls.connect
.
Unison tree-sitter grammar
Tree-sitter is an open-source parsing library that can be used to build syntax highlighting, code folding, and other code editing features. If you've ever wished that your IDE could be "smarter" or more syntactically aware about its suggestions, tree-sitter exists to help languages support those features. Many programming languages publish tree-sitter grammars
Unison's tree-sitter grammar, written by community member Kyle Goetz is an impressive feat. Unison's grammar is complex and Kyle dove into the Haskell code, combed through our language guide and documentation, and we can only imagine spent many hours working to support all of Unison's unique language features.
We can't wait to incorporate this grammar into our IDE's. Thanks Kyle!
Web Sockets
Unison contributor @danfreeman has released a library for working with web sockets in Unison. Web sockets enable both the client and server to send and receive information in a two-way data stream. If you've always wondered how web-sockets work, check out the websockets.serve function to see how http requests are upgraded to web-socket connections.
The ecosystem is filling out with fundamental protocol libraries like this one. They're easy to take for granted if you've worked in older languages, so it's nice to be able to see their foundations in Unison.
XML Soup
For your web-scraping needs, @runarorama has added the Soup library for parsing and querying XML documents. It's nestled inside of a larger Unison XML library, but Soup
is a user friendly interface for traversing through XML so its worth callling out separately.
Fun fact: The Unison blog itself publishes an Atom XML feed: https://www.unison-lang.org/feed.xml. You can use the Soup library to parse and query the feed. Maybe it's time for a Unison RSS reader project? π€
Plotter library
Unison's tooling for making beautiful charts and graphs is getting off the ground thanks to Alvaro's plotter library.
π Thank you to our contributors and community
We're constantly wowed by the the ways that folks are using Unison's unique features to build new tools and libraries. Give our library author's a round of applause, or better yet, use their contributions to make something awesome. Happy coding!