Alexander will be presenting the following session
filter_list help_outline
  • Alexander Granin

    Alexander Granin - Hierarchical Free Monads and Software Design in Functional Programming

    Alexander Granin
    Alexander Granin
    Sr. Haskell Developer
    schedule 1 year ago
    Sold Out!
    45 Mins

    Functional Programming is going through the same process of rethinking as Object Oriented Programming has passed already. FP today is not only something mystical, something barely applicable for day-to-day tasks, but rather a whole philosophy of building big, complex applications, with own tools, approaches and methodologies. We can see a lot of ideas about software design and architecture emerging from the FP community: talks, books, articles. We’re actively discussing Final Tagless, Free Monads, effect systems and other approaches, but it seems the theme not yet covered and we don’t know about possibilities we have.

    In this talk, I’ll tell you about the power of Free Monads in building complex applications in Haskell and PureScript. These applications will be satisfying the requirements like maintainability, testability, simplicity. You’ll know how to create a safe concurrent application state, how to divide the application into layers and how to keep the code sane. In fact, you can do the same with Final Tagless or extensible effects, but the approach with hierarchical Free Monads has some specific properties making it the best tool to separate concerns and create a very interesting eDSLs with different semantics.

    The talk is based on the ideas I’m describing in my book “Functional Design and Architecture”. I also gave several talks about this theme earlier (you can find all my talks here).

    I’ve used these ideas to build software for different companies, including Juspay (Bengaluru), Restaumatic (Poland), Enecuum (Hong Kong). We’ve created several interesting technologies that were not possible to make without Free Monads. Some of them are open sourced.

1. What got you into Functional Programming (FP)?

I had a course "Functional and Logic Programming" in my university, but I didn't get the idea that time. After the university I started working as a C++ developer. To the moment, I've created an application for my thesis work, and used some concepts that I didn't know are best applicable to FP. In particular, I realised the power of purity, declarative design, interpretable and other kinds of eDSLs.

After a while, I realised the existence of Haskell language (it was 2010), and noticed this language is very strange. I read an article, didn't understand it completely and started experimenting with Haskell from small steps. And this was a great experience. Haskell "clicked" in me immediately.

2. What has been your best moment or highlight working with FP?

The moment of diving into a strange, alien but very nice language Haskell. I was so happy when I started understanding its coolness after a week of experimenting. I had never experienced such pleasure from programming: neither before, nor after this moment.

3. What are some of the greatest challenges of working with FP?

I've implemented a working Software Transactional Memory in Haskell and C++ and given several talks about it. The library is based on the ideas I'm building during a fair amount of time (Free monads in particular). It was hard, especially to implement STM in C++, but I succeeded.

I'm challenging myself all the time because I'm writing a book "Functional Design and Architecture". The book itself is the biggest challenge for now.

4. All the mainstream programming languages are adding functional programming features. Most new languages and frameworks are strongly influenced by FP. What is your advice to object-oriented programmers?

Learn Haskell. It looks mind-blowing yes, but in reality it's the most beautiful and inspirational language out there. It will change the way you're thinking about the code. And it's not that hard as they say, at least basic Haskell is not hard. Don't be afraid of monads, and don't read all those mathy tutorials. Just experiment with the code, and from the practice, you'll see the main monads are finely understandable. Don't try to understand what a monad is, but rather see how to use particular monads in practice.

5. What will be some of the key takeaways from your sessions at the conference?

- How to do Inversion of Control in Haskell with Free monads

- How it helps in testing

- How to build big applications in Haskell with this approach

- What are the benefits and disadvantages

- What is relation to the mainstream principles and pratices

6. The conference has more than 50 sessions. Which ones are you most looking forward to attending and why?

Haskell talks because I love this language.

Other talks, as well. I'm still building my own schedule.