I have to admit that I am still not "there" yet when it comes to working efficiently with monads, so please forgive me if this is an easy question. I also have to apologize for not supplying working code, as this questions more related to a concept than an actual implementation that I am currently working on.
I'm working against an SQLite(3) database, and of course would like to send queries to it and get results back. Being already in IO, the fetchAllRows
function returns an [[SqlValue]]
which needs to be converted. With SQLite being very liberal in terms of what is text and what is floating point values (and Haskell not being liberal at all when it comes to types), safe conversion using safeFromSql
seems appropriate. Now, if you manage to do all this in one function you would end up with that function being
myfunc :: String -> [SqlValue] -> IO [[ Either ConvertError a]]
or something like that, right? It seems to me that working with that structures of nested monads may be common enough (and cumbersome enough) for there to be a standard way of making it easier to work with that I am not aware of?