4 ms·
> You then provided an example of something you claimed could not be done monadically. Using a monad, i.e., an endofunctor with unit and join that satisfies th
by catnaroek 9y ago
> You then provided an example of something you claimed could not be done monadically.
Using a monad, i.e., an endofunctor with unit and join that satisfies the well-known laws, you cannot do it.
> I pointed out that you could implement such a thing with "indexed monads", which are a subclass of monads (although not one that's easily used in any current programming language, Haskell included).
Is a so-called “indexed monad” really a monad, now?
> You then claimed that in order to implement the memory allocation example you would need substructural types, which is not the case.
It is the case. What else could be the point to the threaded typestate in the definition of so-called “indexed monads”? Moreover, even with the threaded typestate, so-called “indexed monads” may fail to achieve the desired goal of manipulating resources linearly, e.g. the “indexed list monad” provides no such guarantees.