1 Nov 09:46 2013

## SYB: queries using IO Monad

JP Moresmau <jpmoresmau <at> gmail.com>

2013-11-01 08:46:59 GMT

2013-11-01 08:46:59 GMT

Hello cafe,

I have code that works well using the syb package, and the ext1Q, extQ and gmapQ functions. This code that a Data and transforms it into something else.

However I need to make a change, and this change involves calling a function in the IO monad (the function is from another library so I have no choice). However, the ext1Q, extQ and gmapQ functions have no monadic equivalent. There seems to be monadic transformation (from a to different a) but no monadic queries (from a to b).

--

JP Moresmau

http://jpmoresmau.blogspot.com/

Do I have to rewrite these functions myself to work with monadic queries (it at all possible) or is there a better way? I've seen some functions that work with monads and MonadPlus, but I don't see anything that would work with IO.

So far I've checked that the IO() function I'm calling does the job by using unsafePerformIO, but I know that's a sin and I'd like to find a better way!

Thanks!

JP

JP Moresmau

http://jpmoresmau.blogspot.com/

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