Another month, another fantastic meetup! This time we were treated to a lesson in combining music with Elm by the exceptional John Watson, and given a whistle stop tour of functional web language design by the phenomenal Bodil Stokke.
John led us on an audio journey using one of the hottest languages around - Elm! He demonstrated what’s available with today’s browser Web Audio APIs, how we can use soundfonts to produce different flavours of noise, and taught us the ABC musical notation structure - a way of describing music that fits well with traditional genres.
With the clever Elm Combine in hand, we were shown how swiftly and elegantly we can write our own parser for the ABC musical notation and get something playing in our browser pretty quick!
John also talked about the practicalities of writing an Audio API library for Elm, the restrictions libraries have, why they exist, and what you can do to overcome these challenges.
We were treated to a demo of all this in action with some live music - check out his talk in the video below and have a listen for yourself!
There were plenty of juicy Elm tips and approaches shown - visit his Elm project on GitHub for some beautiful and pragmatic code.
A Realist’s Guide to Language Design - Bodil Stokke
Bodil grabbed our hands and took us through the fields of functional programming languages to teach us that there is no single best language, no silver bullet for every situation. Luckily, she provided the tools to let us make our own decision about which languages suit us and our projects.
After a fun introduction reminiscent of Gary Bernhardt’s famously charming ’Wat’ talk, Bodil asked us to think about some key aspects of language design, and if we were to make our own, what are the kind of things we should be thinking about?
- What are you trying to achieve?
- Who and for whom are you trying to achieve it for?
- What level of abstraction is right?
She emphasised that a good programming language should ideally feel like you're having a conversation with your compiler.
Bodil then whizzed through examples in Elm, PureScript, and JS extensions to highlight their similarities, differences and what those could mean to you.
Elm is extremely browser focused, letting you get on your feet very quickly if your goal is a web application. It forces you to use a very specific type system that allows it to serve you immensely helpful error messages, automatically ensure package are where they're meant to be and delivers solid confidence in development.
However, Bodil demonstrated that even uglified, Elm took up 108kb of space, and Elm on the server is a bit of a wish at the moment! Using foreign JS outside of the Elm space can also be a pain, and relies on the use of ports.
PureScript has a more generic type system, allowing you to reach a higher level of abstraction than Elm. However this more complex, powerful type system means there’s a loss in simplicity, the error messages aren’t as helpful, and you may need to reference a site like Pursuit for occasional guidance.
Through the use of libraries like Flow, it’s possible to gain some of the positives of type systems without committing to a whole new language. This is fantastic news for legacy projects that want to gradually improve rather than commit to the risky gambit of a full re-write.
Which one is right for you? Bodil stressed that each has a different purpose, and we should take what we’ve learnt to assess what we need, what effort we have available, and the future.
Watch her talk and give us your thoughts!
That’s all! Thanks to everyone who came along, our gracious speakers, and to Skills Matter for hosting.
See you all next month!
If you aren't already a member of the Functional Programming for the Web meetup you can join here. See you at our next event!