
Hello, I would like to create few functions which use parametrized monads (defined as in http://computationalthoughts.blogspot.com/2009/02/comment-on-parameterized-m... ) 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

On 27 Feb 2009, at 01:06, frea wrote:
Hello, I would like to create few functions which use parametrized monads (defined as in http://computationalthoughts.blogspot.com/2009/02/comment-on-parameterized-m... ) 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?
The definition of (>>) is not determined by which module you're in, instead by what the types it is operating on are. Check which monad these functions really are in, and you'll probably find your error. Bob
participants (2)
-
frea
-
Thomas Davie