[Haskell-cafe] SYB: queries using IO Monad

JP Moresmau jpmoresmau at gmail.com
Fri Nov 1 08:46:59 UTC 2013


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).
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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131101/33da69b1/attachment-0001.html>


More information about the Haskell-Cafe mailing list