logoalt Hacker News

sodictoday at 12:30 PM3 repliesview on HN

This is my favorite one, short and understandable: https://philipnilsson.github.io/Badness10k/posts/2017-05-07-...

I show it when I teach Haskell, and it's what usually makes it "click" for students. Probably because motivating examples are in normal imperative pseudocode.


Replies

whilenot-devtoday at 1:10 PM

Your linked article hints at the advantages of using Monads and therefor ADTs (Algebraic Data Types), and does it really well.

The wiki entry on effect systems[0] tells me that a focus of an effect system is something different from a focus of monads. "The term algebraic effect follows from the type system", where an effect system is effectively a type and effect system. It links to Monadic encapsulation of effects[1] and mentions the runST monad when it mentions support in Haskell, as that one seem to "simulate a type and effect system".

Do have any such a link on the runTS monad?

[0]: https://en.wikipedia.org/wiki/Effect_system

[1]: https://www.cambridge.org/core/journals/journal-of-functiona...

skybriantoday at 5:48 PM

One thing this page makes clear is that do-syntax could mean all kinds of things, which seems like a disadvantage for readability. Assuming you know the specialized syntax, elvis operators looking different from async code or a nested for loop seems like an advantage? The performance implications are entirely different.

tometoday at 12:43 PM

Thanks, I definitely feel like I understand monads and their benefits, and even "effects", but I'm not sure what's "algebraic" in "algebraic effects".

show 1 reply