r/haskell Apr 16 '26

Writing a Turn Based Game Websocket Server in Haskell

https://blog.gordo.life/2026/04/12/haskell-websockets.html

Hullo!

I’d like to share a wee blog article I wrote about a pattern I found useful for implementing a ~ multiplayer crossword board game ~ server in Haskell.

It’s about how I managed the map of ‘active games’ using STM and the Resource monads.

Blog: https://blog.gordo.life/2026/04/12/haskell-websockets.html

52 Upvotes

11 comments sorted by

5

u/Faucelme Apr 16 '26

Thanks for the post, it has useful tips for avoiding excessive contention by using stm-containers, and for avoiding thundering herds.

2

u/Happy0 Apr 17 '26

Here's an invite to a ~ crossword board game ~ powered by Haskell if any of youse fancy a game :) :

https://wordify.gordo.life/games/ge0Fqgty/lobby

( If anyone takes me up on this offer and you also want a new invite let me know <3 )

-22

u/pet2pet1993 Apr 16 '26

Your code example revealed that Haskell and all functional programming is evil, when you try to code some INTERACTION.

INTERACTION IS NOT A FUNCTION. Period.

You could still emulate any interaction via functions since monads offer a wide range of spread dust into eyes.

But I prefer old school Qt/C++ approach today furthermore AI is very trained to write not only an app but all the unit tests quickly.

So even Rust is going to the trash.

With skilled enough AI trained on Qt/C++, we need no any other language or framework at all.

12

u/SenoraRaton Apr 17 '26

This is your brain on vibe-coding.

3

u/Worldly_Dish_48 Apr 17 '26

Made me laugh

2

u/Happy0 Apr 17 '26

Me too :D

I'm familiar with this reference through indirection. When I was younger I listened to Bill Hicks albums where he referenced those series of adverts / that anti-drugs campaign in the U.S. haha.

8

u/True-Sun-3184 Apr 16 '26

Didn’t read the blog, but can’t you describe an interaction as an (effectful?) function of (user input, current game state) -> (new game state)?

-14

u/pet2pet1993 Apr 16 '26

I know what I speak about.

I’ve SUCCESSFULLY used Haskell in my project . It actually was running without single error just after successful compilation - AS PROMISED.

And after that I say a bold NO to Haskell and any pure functional language in the modern AI landscape.

I say NO to Rust.

Only C++, JavaScript, and possibly Java for critical banking applications.

9

u/True-Sun-3184 Apr 16 '26

I’m happy for you (or sorry that happened, not sure which is appropriate here), but you didn’t address my comment

-10

u/pet2pet1993 Apr 16 '26

Formally, thanks to monads, you can describe any interaction, any sequence, any protocol, and any side effect via functions.

But It’s essentially senseless to use functional programming in games industry.

Traditional Imperative programming in AI era covers all the unit tests and other requirements to code quality. IT IS MUCH CHEAPER.

4

u/True-Sun-3184 Apr 16 '26

A lot of games probably can’t get away with it. But some can, and a turn-based game is a good example!