I have the following code with a pipe which is ok without the second pipe (>-> P.mapM ( fillMD5)). fillMD5 is an operation a -> IO a.
runSafeT $ runEffect $
every (senseRecursive5 startfpo)
>-> P.mapM ( fillMD5)
>-> P.map fp2rdf
>-> toNTriple houtfile
The error is :
Couldn't match type `IO' with `Pipes.Safe.SafeT IO'
Expected type: Pipes.Safe.SafeT IO ()
Actual type: IO ()
In the second argument of `($)', namely
`runEffect
I understand that the type of mapM is
mapM :: Monad m => (a -> m b) -> Pipe a b m r
but I do not see how to lift this into Safe.SafeT?
SafeTis a monad transformer, and soSafeT IOis a composite monad withIOwrapped inSafeT. To usefillMD5, you need to lift the computation it produces to the composite monad usinglift(from theMonadTransclass):As
fillMD5produces anIOaction, you can also useliftIO, which comes from theMonadIOinstance ofSafeT: