Having to understand monad transformers or another kind of effect system to get anything working is a heavy load that's unnecessary in other languages.
Having to understand monad transformers or another kind of effect system to get anything working is a heavy load that's unnecessary in other languages.
I'd say knowing how to use monad transformers is the barrier between intermediate and expert Haskell programmers.
How do you think the folks on Java and C# find their work worth doing on their end in that case?
runState do
value <- get
put counter+1
The problem comes when you also want to do IO with that state; if your code is in the IO monad it has no access to the State monad and can't call those methods. There are ways to work around that but monad transformers give you a StateT which can be applied to any base monad, including IO, giving you the capability of both.You set up your pipeline in terms of monads and then when you want to execute it you run it in IO. You can generalize IO to MonadIO or define an alias to some transformer pinned at IO. It adds a Computational overhead. Transformers are a solution to monad composition which isn’t naturally possible.
Effect systems and monad transformers are advanced topics. They're possible to use in my language yet most people do not and can still write software.
Certainly no need for them in Haskell to be successful. You can just program at the lower levels of abstraction common in other languages.
The only difference is that Haskell's community tends to emphasize abstraction