Skip to content
Browse files

Stop using quasiquotes in Simple.hs

For some reason this was causing haddock to fail.   This may be a bug
in cabal-install or ghci and is worth further investigation at some point.
For example

$ cabal haddock
Running Haddock for postgresql-simple-0.3.0.0...
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: rts-1.0
Preprocessing library postgresql-simple-0.3.0.0...
Haddock coverage:
   2% (  1 / 49) in 'Database.PostgreSQL.Simple.TypeInfo'
   8% (  4 / 50) in 'Database.PostgreSQL.Simple.Time.Implementation'
   9% (  1 / 11) in 'Database.PostgreSQL.Simple.Time.Internal'
   4% (  1 / 26) in 'Database.PostgreSQL.Simple.Time'
  80% (  8 / 10) in 'Database.PostgreSQL.Simple.Arrays'
 100% (  2 /  2) in 'Database.PostgreSQL.Simple.SqlQQ'
  88% (  7 /  8) in 'Database.PostgreSQL.Simple.Types'
 100% (  4 /  4) in 'Database.PostgreSQL.Simple.ToField'
 100% (  2 /  2) in 'Database.PostgreSQL.Simple.ToRow'
  67% (  2 /  3) in 'Database.PostgreSQL.Simple.Ok'

dist/build/tmp-15448/src/Database/PostgreSQL/Simple/Internal.hs:44:1:
    Warning: The import of `System.IO.Unsafe' is redundant
               except perhaps to import instances from `System.IO.Unsafe'
             To import instances alone, use: import System.IO.Unsafe()
  38% (  9 / 24) in 'Database.PostgreSQL.Simple.Internal'
  22% (  4 / 18) in 'Database.PostgreSQL.Simple.LargeObjects'
  75% (  3 /  4) in 'Database.PostgreSQL.Simple.Notification'
  80% (  4 /  5) in 'Database.PostgreSQL.Simple.Errors'
 100% (  3 /  3) in 'Database.PostgreSQL.Simple.Compat'
  17% (  1 /  6) in 'Database.PostgreSQL.Simple.BuiltinTypes'
  79% ( 11 / 14) in 'Database.PostgreSQL.Simple.FromField'
  33% (  2 /  6) in 'Database.PostgreSQL.Simple.FromRow'

ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziSqlQQ_sql_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org
  • Loading branch information...
1 parent 72e419e commit aaa12f3cc05fb51aadbdb3c8c3cb693f1212d14d @lpsmith committed Jan 27, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/Database/PostgreSQL/Simple.hs
View
13 src/Database/PostgreSQL/Simple.hs
@@ -4,7 +4,6 @@
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
-{-# LANGUAGE QuasiQuotes #-}
------------------------------------------------------------------------------
-- |
@@ -145,7 +144,6 @@ import Database.PostgreSQL.Simple.ToRow (ToRow(..))
import Database.PostgreSQL.Simple.Types
( Binary(..), In(..), Only(..), Query(..), (:.)(..) )
import Database.PostgreSQL.Simple.Internal as Base
-import Database.PostgreSQL.Simple.SqlQQ (sql)
import qualified Database.PostgreSQL.LibPQ as PQ
import qualified Data.ByteString.Char8 as B
import qualified Data.Text as T
@@ -1035,12 +1033,11 @@ getTypeInfo conn@Connection{..} oid =
case IntMap.lookup (oid2int oid) oidmap of
Just typeinfo -> return (oidmap, typeinfo)
Nothing -> do
- names <- query conn
- [sql| SELECT p.oid, p.typname, c.oid, c.typname
- FROM pg_type AS p LEFT OUTER JOIN pg_type AS c
- ON c.oid = p.typelem
- WHERE p.oid = ?
- |] (Only oid)
+ names <- query conn "SELECT p.oid, p.typname, c.oid, c.typname\
+ \ FROM pg_type AS p LEFT OUTER JOIN pg_type AS c\
+ \ ON c.oid = p.typelem\
+ \ WHERE p.oid = ?"
+ (Only oid)
typinf <- case names of
[] -> return $ throw (fatalError "invalid type oid")
[(pOid, pTypName, mbCOid, mbCTypName)] ->

6 comments on commit aaa12f3

@dzhus
dzhus commented on aaa12f3 Jan 29, 2013

Does this mean that non-GHCi error such as this (a package depends on postgresql-simple-0.3) is also a bug in GHC?:

Resolving dependencies...
Configuring carma-sync-0.1.2.6...
Building carma-sync-0.1.2.6...
Preprocessing executable 'partner_service-clean' for carma-sync-0.1.2.6...
Linking dist/build/partner_service-clean/partner_service-clean ...
/home/dzhus/projects/carma/srv/cabal-dev//lib/postgresql-simple-0.3.0.0/ghc-7.6.1/libHSpostgresql-simple-0.3.0.0.a(Simple.o): In function `s16zm_info':
(.text+0xb858): undefined reference to `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziTransaction_withTransaction2_info'
/home/dzhus/projects/carma/srv/cabal-dev//lib/postgresql-simple-0.3.0.0/ghc-7.6.1/libHSpostgresql-simple-0.3.0.0.a(Simple.o):(.data+0x10): undefined reference to `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziTransaction_TransactionMode_static_info'
/home/dzhus/projects/carma/srv/cabal-dev//lib/postgresql-simple-0.3.0.0/ghc-7.6.1/libHSpostgresql-simple-0.3.0.0.a(Simple.o):(.data+0x18): undefined reference to `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziTransaction_ReadCommitted_closure'
/home/dzhus/projects/carma/srv/cabal-dev//lib/postgresql-simple-0.3.0.0/ghc-7.6.1/libHSpostgresql-simple-0.3.0.0.a(Simple.o):(.data+0x20): undefined reference to `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziTransaction_ReadOnly_closure'
/home/dzhus/projects/carma/srv/cabal-dev//lib/postgresql-simple-0.3.0.0/ghc-7.6.1/libHSpostgresql-simple-0.3.0.0.a(Simple.o): In function `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimple_zdwa1_srt':
(.data+0xd60): undefined reference to `postgresqlzmsimplezm0zi3zi0zi0_DatabaseziPostgreSQLziSimpleziTransaction_withTransaction2_closure'
@lpsmith
Owner

I don't know, though it would be interesting to git-bisect postgresql-simple to figure out which commit caused carma-sync linking to fail. Even if it isn't really our problem, it would likely be helpful in figuring out what the problem really is.

@lpsmith
Owner

Actually, I see what the (likely) problem with that is; try adding Database.PostgreSQL.Simple.Transaction to the Exposed-modules in postgresql-simple.cabal; I would myself but I can't conveniently push to github from where I'm sitting.

@dzhus
dzhus commented on aaa12f3 Jan 29, 2013

Database.PostgreSQL.Simple.Transaction to the Exposed-modules in postgresql-simple.cabal

Yay, this helped me build my module, thank you. What is the problem here exactly?
Shouldn't GHC terminate gracefully when encountering an unknown identifier from
invisible module instead of breaking bad-ly due to linking error?

Actually at some point I could not even build current head of postgresql-simple-0.3 itself due to this error:


Configuring postgresql-simple-0.3.0.0...
Building postgresql-simple-0.3.0.0...
Preprocessing library postgresql-simple-0.3.0.0...

on the commandline: Warning:
    -no-user-package-conf is deprecated: Use -no-user-package-db instead

on the commandline: Warning:
    -package-conf is deprecated: Use -package-db instead

src/Database/PostgreSQL/Simple.hs:131:18:
    Could not find module `Database.PostgreSQL.Simple.Transaction'
    Perhaps you meant
      Database.PostgreSQL.Simple.Notification (needs flag -package postgresql-simple-0.3.0.0)
      Database.PostgreSQL.Simple.Arrays (needs flag -package postgresql-simple-0.3.0.0)
      Database.PostgreSQL.Simple.FromRow (needs flag -package postgresql-simple-0.3.0.0)
    Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:

However, I could not reproduce this anywhere other than our buildbot.

@lpsmith
Owner

Yeah, these types of linking issues I'm not overly familiar with, so I can't speak to that with my current level of knowledge.

As for your buildbot... are you using Travis CI? To my (limited) knowledge, that's the only buildbot that would sensibly exhibit this problem, as it's currently the only commonly used buildbot that integrates with the cabal build system. All the rest go through shell scripts and whatnot.

@dzhus
dzhus commented on aaa12f3 Jan 31, 2013

By buildbot I mean a dedicated server we have that does nigthly builds and deployment of the system, which requires some extra work in addition to recompiling a cabalized package. It doesn't use any custom software, just a shell script using cabal-dev and cabal-meta.

Please sign in to comment.
Something went wrong with that request. Please try again.