[Haskell-cafe] coding standard question

david48 dav.vire+haskell at gmail.com
Fri Jun 26 05:30:32 EDT 2009


On Thu, Jun 25, 2009 at 3:27 AM, wren ng thornton<wren at freegeek.org> wrote:

> If certain warnings truly are spurious and unavoidable, then it's best to
> document this explicitly in the code by pragmas to disable the relevant
> warnings. This way the spurious nature of the warning is documented (for
> future maintainers, including yourself) and the distracting output of the
> compiler is removed as well. Unfortunately, GHC only gives whole-file scope
> for disabling warnings, but that could be fixed with enough work.

Hello all,
Forgive me if I'm a bit out of topic, but following this thread, I
decided to add -Wall -Werror for a program I'm working on.
I've spend a bit of time correcting quite a lot of warnings, most of
them being about missing type signatures. I've corrected them all, but
there remains one that I can't :  ghc refuses the type signature it
suggests me.

Anyone has any idea ?

=====================================
david at pcdavid2:~/projets/haskell/caimonitor$ ./g
[3 of 4] Compiling Bdd              ( Bdd.hs, Bdd.o )

Bdd.hs:27:0:
    Warning: Definition but no type signature for `connecter'
             Inferred type: connecter :: IO

HDBC-mysql-0.6:Database.HDBC.MySQL.Connection.Connection

<no location info>:
Failing due to -Werror.
=====================================

Here's part of the code : without -Werror, the code compiles and works fine.

======================================
module Bdd where

import Database.HDBC
import Database.HDBC.MySQL
import Text.Printf
import Messages

mysqlInfo :: MySQLConnectInfo
mysqlInfo = defaultMySQLConnectInfo { mysqlHost ="xxx.xxx.xxx.xxx"
                                    , mysqlUser = "xxxxxxxx"
                                    , mysqlPassword = "xxxxxxxx"
                                    , mysqlDatabase = "xxxxxx"
                                    , mysqlPort = 0
                                    , mysqlUnixSocket =""
                                    }

--connecter :: IO Database.HDBC.MySQL.Connection.Connection
connecter        = connectMySQL mysqlInfo
...
...
...
======================================

Thanks,

David


More information about the Haskell-Cafe mailing list