[Haskell-beginners] monad and variable result

Francesco Ariis fa-ml at ariis.it
Mon Dec 10 11:19:43 UTC 2018

Hy Damien,

On Mon, Dec 10, 2018 at 11:32:23AM +0100, Damien Mattei wrote:
> i want  the variable local_bd_rows accessible in the 'where' clause

does `query` return IO ()? If so, no you can't*. Once the result
is inside IO, it stays in IO. Move what you need inside out of where
(and inside a `do`) and get ready to change the signature of
`getBD` to

    getBD :: Connection -> String -> IO Float


* (you can with unsafeSomething functions, but it is really really
advisable not to do that).

More information about the Beginners mailing list