What is the difference between Writer and WriterT in Haskell? Is one preferred over the other?
What is the difference between Writer and WriterT in Haskell? Is one preferred over
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The difference is that
Writeris a monad, whereasWriterTis a monad transformer, i.e. you give it some underlying monad, and it gives you back a new monad with “writer” features on top. If you only need the writer-specific features, useWriter. If you need to combine its effects with some other monad, such asIO, useWriterT.