[Haskell-cafe] haskelldb + sqlite problem.

Colin Paul Adams colin at colina.demon.co.uk
Sat Sep 5 03:01:59 EDT 2009

>>>>> "Colin" == Colin Paul Adams <colin at colina.demon.co.uk> writes:

>>>>> "Magicloud" == Magicloud Magiclouds <magicloud.magiclouds at gmail.com> writes:
    Magicloud> Hi, I am using haskelldb and
    Magicloud> haskelldb-hdbc-sqlite3. Well, I finally got the source
    Magicloud> compiled and ran, I got this error: App: user error
    Magicloud> (SQL error: SqlError {seState = "", seNativeError = 21,
    Magicloud> seErrorMsg = "prepare 74: SELECT subject,\n
    Magicloud> timestamp\nFROM notes as T1\nORDER BY timestamp DESC:
    Magicloud> library routine called out of sequence"}) Any clue what
    Magicloud> I should check?

    Colin> Did you get this working? If so, what was the problem and
    Colin> how did you go about resolving it.

    Colin> I have the identical problem. I had the database code
    Colin> working fine, but then I added a state monad into the monad
    Colin> stack for the program, and now I get this problem.  I see
    Colin> that John Goerzen suggested it might be a result of reading
    Colin> the data lazily.  So I tried changing my import statements
    Colin> from import Control.Monad.State to import
    Colin> Control.Monad.State.Strict

    Colin> in case the StateT was indirectly causing the problem, but
    Colin> that doesn't make any difference.

As I suspected, the problem is something to do with my putting the
Database.HaskellDB.Database.Database into the state monad, and getting
it from there, rather than passing it around explicitly. So I guess I
have too much laziness in:

ApplicationState db _ <- lift get

How do I force db in this situation?
Colin Adams
Preston Lancashire

More information about the Haskell-Cafe mailing list