[Haskell-cafe] writer monad help
iskaldur
iskaldur at gmail.com
Fri May 18 07:32:09 EDT 2007
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.
More information about the Haskell-Cafe
mailing list