hdbc / hdbc-sqlite3

Sqlite v3 driver for HDBC
BSD 3-Clause "New" or "Revised" License
21 stars 6 forks source link

Fetching records lazily after closing a connection should raise an error #21

Open igrep opened 6 years ago

igrep commented 6 years ago

Minimum code to reproduce

import Database.HDBC
import Database.HDBC.Sqlite3

main :: IO ()
main = do
  c <- connectSqlite3 "some.db"
  r <- quickQuery c "select 1;" []
  disconnect c
  print r

Expected result

Raise an error to tell the connection is already closed, similarly to putStrLn =<< (withFile "file" ReadMode $ hGetContents).

Actual result

Only an empty list [] is printed without any error. This can make it very hard to detect I used lazy IO in a wrong way.

My environment

igrep commented 6 years ago

ping