[Haskell-cafe] coding standard question

david48 dav.vire+haskell at gmail.com
Mon Jun 29 04:47:05 EDT 2009


Hello Daniel and all,
Your suggestion #1 : Can't import Database.HDBC.MySQL.Connection :

david at pcdavid2:~/projets/haskell/caimonitor$ ghci -Wall Bdd.hs
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.

Bdd.hs:15:7:
   Could not find module `Database.HDBC.MySQL.Connection':
     it is a hidden module in the package `HDBC-mysql-0.6'
     Use -v to see a list of the files searched for.
Failed, modules loaded: none.
Prelude>
Leaving GHCi.

Your suggestion #2 : Unfortunately, the type isn't exported, as it seems :

The doc says :

*This module provides a MySQL driver for the HDBC database interface.
To use it, invoke the 'connectMySQL' method to create an
@Database.HDBC.IConnection@ that you can use to interact with a MySQL
database.  Use the 'defaultMySQLConnectInfo', overriding the default
values as necessary.*

so I tried :
connecter :: IO IConnection
connecter = connectMySQL mysqlInfo

But then that didn't work too, because IConnection is a class, not a type (
which is not obvious from the documentation snippet I read)

So then I tried :

connecter :: IConnection conn => conn
connecter = connectMySQL mysqlInfo

And even though I suspect that's the correct type, it fails too :

david at pcdavid2:~/projets/haskell/caimonitor$ ghci -Wall Bdd.hs
GHCi, version 6.10.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
[2 of 2] Compiling Bdd              ( Bdd.hs, interpreted )

Bdd.hs:27:12:
    Couldn't match expected type `conn'
           against inferred type
`HDBC-mysql-0.6:Database.HDBC.MySQL.Connection.Connection'
      `conn' is a rigid type variable bound by
             the type signature for `connecter' at Bdd.hs:26:25
      Expected type: IO conn
      Inferred type: IO

HDBC-mysql-0.6:Database.HDBC.MySQL.Connection.Connection
    In the expression: connectMySQL mysqlInfo
    In the definition of `connecter':
        connecter = connectMySQL mysqlInfo

I looked at Connection.hsc from the library and the Connection type defined
there isn't exported.

For now, I've disabled that type of warnings.

Thanks,

David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090629/32143a26/attachment.html


More information about the Haskell-Cafe mailing list