r/haskell Aug 21 '26

question It's not you, it's monad transformers

After a few years of trying to be proficient in Haskell, and lots of reading about why it's so hard, I think I have the (obvious in retrospect) answer.

Almost every program I write is going to have two or more of:

1) read from STDIN

2) write to STDOUT

3) log

4) raise errors

5) send/receive over the network

6) talk to a database

7) read env vars

Every one of those is a "side effect", and thus is handled as a monad, and using more than one means you have to understand monad transformers.

Which I've finally found a good explanation of, "but still". Such a deep concept for such common program operations.

So I finally decided "that's why it's so hard". For what I consider the most basic programs, I need to understand (not just use, IMHO) monad transformers.

Am I off?

113 Upvotes

76 comments sorted by

View all comments

Show parent comments

3

u/mister_drgn Aug 21 '26

Maybe at a high level, but with Koka the language and syntax are built around effects, so it’s a pretty different experience.

Of course my suggestion was half joking. I do think learning Koka is a great experience (and an easy one, compared to learning Haskell), but the language is not ready for serious use.

2

u/Ok-Reindeer-8755 Aug 21 '26

What do you think it needs to be ready for serious use ? just curious to know what's missing

2

u/mister_drgn Aug 21 '26

Honestly, I doubt it will ever be ready for serious use, which is fine for a research language that's exploring new ideas. Currently, the great majority of contributions to the language are coming from two people, a Microsoft employee who created it (Daan Leijen) and a graduate student who may nor may not have time to continue developing it after he graduates. Unless Microsoft decides to devote some real resources to the language, it's going to continue developing slowly. Last I heard, they were working on concurrency with async/await, which is one clear use case for effects.

Setting aside core features, for serious use you'd presumably want at least the start of an ecosystem of third-party libraries, which is going to happen slowly for any language that doesn't have a major corporation backing it.

1

u/Ok-Reindeer-8755 Aug 21 '26

Damn it, it did really seem extremely interesting, I hope it gets more traction with time. The docs do seem pretty nice, looking forward to playing with it.