[Haskell-cafe] strange type mismatch when trying to use takusen

Seth Gordon sethg at ropine.com
Thu Nov 23 23:59:56 EST 2006


I have a simple test program for takusen and PostgreSQL:

> import Database.Enumerator
> import Database.PostgreSQL.Enumerator
> import Control.Monad.Trans
> 
> gazdbSession dbname = connect [CAdbname dbname]
> 
> resultCollector :: (Monad m) => String -> IterAct m [String]
> resultCollector str accum = result' (str:accum)
> 
> main = do withSession (connect [CAdbname "template1"]) $ main'
> 
> main' = do r <- doQuery (sql "select 'fred'") resultCollector []
>            liftIO $ putStrLn $ show r

But it won't compile:

[1 of 1] Compiling Main             ( takusen-test.hs, takusen-test.o )

takusen-test.hs:11:57:
     Couldn't match expected type `forall mark. DBM mark Session a'
            against inferred type `DBM mark sess ()'
     In the second argument of `($)', namely `main''
     In the expression:
           (withSession (connect [CAdbname "template1"])) $ main'
     In the expression:
         do (withSession (connect [CAdbname "template1"])) $ main'

Adding an explicit "main' :: DBM mark Session ()" type signature doesn't 
change the error message.

The takusen source that I'm using was updated from darcs on November 14 
and compiled with ghc 6.6.


More information about the Haskell-Cafe mailing list