4 ms·
It's all about thinking frameworks. Ensuring that effects are declared, that data has a static lifetime, or that your program is rewritable data are tools you c
by marcosdumay 5y ago
It's all about thinking frameworks. Ensuring that effects are declared, that data has a static lifetime, or that your program is rewritable data are tools you can use to focus your mind in one part of the problem and less in another. Just like having irestricted access to everything your computer can do, or data + code encapsulation with multiple access levels.
Not recognizing this (like in the article) is a clear sign of a single-paradigm developer that never really understood anything else but is too arrogant (insecure maybe?) to assume he doesn't understand something. So, the problem must be with everybody else.
Anyway, a funny red-flag is that reaction to Haskell IO. People that never really learned Haskell tend to complain about IO with a deeper complaint of "why to I have to keep using monads?", while after people learn it they tend to complain about the lack of monad composition, with a deeper complaint of "why can't I use monads for everything?"
- arunix 5y agoCan you say more about the latter i.e. lack of monad composition ("why can't I use monads for everything") ?
- marcosdumay 5y agoAfter you learn how to solve states, input data, output data, error handling, parsing context, resource mocking, guaranteed resource release, and a lot of other things just by declaring the correct monad when you call your code, people tend to want to solve several of those at the same time. But for solving several of them, you need to compose your monads, and there is no good general way to do that. There are context dependent ways to compose some of them, but you are always thinking about their compatibility and they often require that you specialize your code.
- a1369209993 5y ago> But for solving several of them, you need to compose your monads, and there is no good general way to do that. It's (provably, I think) impossible for fully general monads, but for traversable-but-otherwise-general monads you can do[0]: newtype (%) (f1::k1->Type) (f2::k2->k1) (a::k2) = Comp { unComp :: (f1 (f2 a)) } instance (Monad f1,Monad f2,Traversable f2) => Monad (f1 % f2) where join (Comp a) = Comp $ a >>= (map join . mapA (unComp )) (Comp a) >>= k = Comp $ a >>= (map join . mapA (unComp . k)) (For that matter, you only need f2 to be traversable; f1 can be any monad at all.) 0: copied from my own code, so it might need other adjustment than s/map/fmap/ and s/mapA/traverse/.
- josephcsible 5y agoThat instance is type-correct but unlawful: https://stackoverflow.com/q/42284879/7509065 https://stackoverflow.com/q/42284879/7509065
- int_19h 5y agoCL is one of the most prominent examples of multi-paradigm languages, though.