Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Exactly!

You can also write a generic "sequence" over a list, for instance, so that any 'monad' (task/future, maybe/option, state, either/disjunction etc.) can 'swap places'.

So your List<Future<A>> can become Future<List<A>>. But you only need to write it once. Then it doesn't matter what the inner type of the List is, as long as it's a monad (applicative, really, but all monads are applicatives).



Crazy, I'd always considered monad transformers a sore thumb on, well, all that stuff. The fact that monads weren't enough but then you had to go reproduce all that stuff in monad transformers as well. The whole thing just reeked of code duplication and bad smells so I didn't really look into it further.

Now looking at the Scalaz impl, the transformers are actually the core thing, and monads themselves are just transformers over Identity. So it all fits and isn't redundant. Certainly changes a lot of perspective.


That said, I'd still put LINQ as 99% of "the deal" per the original comment. The extra abstractions allowed by HKT's, while "necessary" mathematically, still only save me about 1% of the work required to implement asyncSeq and asyncMaybe, and in 15 years of pro experience those are the only real uses of HKT's I've ever had the need for.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: