2 ms·
How are monads useful for managing file handles or database connections? You might want to look into 'indexed monads', they can perhaps help with that. But th
by eru 3y ago
How are monads useful for managing file handles or database connections?
You might want to look into 'indexed monads', they can perhaps help with that. But they aren't a type monads (it's the other way round, vanilla monads can be seen as a trivial kind of 'indexed monads', I guess).
- valenterry 3y agoThe encapsulate direct access to those resource and therefore allow a properly controlled lifecycle because usage is then local and cleanup in case of errors is automatic. The caller pretty much can't do anything wrong. No linear types or indexed monads needed actually.