Skip to content

Commit

Permalink
Updated Cabal version to >= 1.18 and changed 'mysqlConfigProgram' to …
Browse files Browse the repository at this point in the history
…work with it.
  • Loading branch information
eyeinsky committed Apr 16, 2014
1 parent 4fb428b commit 67c93d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion HDBC-mysql.cabal 100644 → 100755
Expand Up @@ -12,7 +12,7 @@ Homepage: http://github.com/bos/hdbc-mysql
Bug-Reports: http://github.com/bos/hdbc-mysql/issues
Build-Type: Custom
Tested-with: GHC
Cabal-Version: >= 1.6
Cabal-Version: >= 1.8
Description:
This package provides a MySQL driver for HDBC, implemented via
bindings to the C @mysqlclient@ library.
Expand Down
23 changes: 3 additions & 20 deletions Setup.lhs 100644 → 100755
@@ -1,7 +1,6 @@
#!/usr/bin/env runhaskell

\begin{code}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
import Distribution.Simple
import Distribution.PackageDescription
import Distribution.Version
Expand All @@ -27,26 +26,10 @@ main = defaultMainWithHooks simpleUserHooks {
}
}


-- 'ConstOrId' is a @Cabal-1.16@ vs @Cabal-1.18@ compatibility hack,
-- 'programFindLocation' has a new (unused in this case)
-- parameter. 'ConstOrId' adds this parameter when types say it is
-- mandatory.

class ConstOrId a b where
constOrId :: a -> b

instance ConstOrId a a where
constOrId = id

instance ConstOrId a (b -> a) where
constOrId = const


mysqlConfigProgram = (simpleProgram "mysql_config") {
programFindLocation = \verbosity -> constOrId $ do
mysql_config <- findProgramOnPath "mysql_config" verbosity
mysql_config5 <- findProgramOnPath "mysql_config5" verbosity
programFindLocation = \verbosity _ -> do
mysql_config <- findProgramLocation verbosity "mysql_config"
mysql_config5 <- findProgramLocation verbosity "mysql_config5"
return (mysql_config `mplus` mysql_config5)
}

Expand Down

0 comments on commit 67c93d9

Please sign in to comment.