[Haskell-beginners] using parametrized monads and Prelude.>>

frea korgulec at gmail.com
Thu Feb 26 19:06:37 EST 2009


Hello,
I would like to create few functions which use parametrized monads
(defined as in http://computationalthoughts.blogspot.com/2009/02/comment-on-parameterized-monads.html
) and export their functionality outside a module and use them in a do
statement.
For example three exported funtions :

func1 num = do
        x <- get
        put (show (x + num))

func2 num = do
        x <- get
        put (((read x)::Int) + num)

execWith0 actions = runState actions 0

And in an another module, which has Prelude imported :

k = execWith0 ( do
                func1 10
                func2 5)

Unfortunately this doesn't compile as in the second module >> is
different than in PMonad. Is there any way which I could make it work?

Michal


More information about the Beginners mailing list