3 ms·
> Personally I would call this “execute within context”. Oh, a monad. Yeah, a monad solves it. But it's quite overkill.
by marcosdumay 3y ago
> Personally I would call this “execute within context”.
Oh, a monad.
Yeah, a monad solves it. But it's quite overkill.
- mrkeen 3y agoIt would only be overkill if you had to invent it yourself. But since there's an existing solution, use that. The article went from destructors to the with-pattern. Once you start thinking about exceptions, you might reach for try-with-resources. With Async exceptions you might look at bracket. If you want composability, go for ResourceT.
- marcosdumay 3y agoBasically everything on the article is overkill. You just need to compose the XML contents declaratively... what is the most natural way to compose data. The original API goes out of its way to be dangerous and hard to use.