I'm trying to learn to use the Writer Monad, but I'm having trouble with the
following very simple program:

import Control.Monad.Writer
foo :: Writer String Int
foo = tell "hello"

Basically, I was trying to figure out the 'tell' function, so I want foo to
return ((), "hello").

But I get this error:
Couldn't match `Int' against `()'
      Expected type: Writer String Int
      Inferred type: Writer String ()
    In the application `tell "hello"'
    In the definition of `foo': foo = tell "hello"

What am I supposed to do? Write my own version of tell for Writer String
Int? How exactly do I do this?
-- 
View this message in context: 
http://www.nabble.com/writer-monad-help-tf3777133.html#a10680445
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to