Skip to content

Commit

Permalink
Merge pull request #81 from plcplc/master
Browse files Browse the repository at this point in the history
Update to GHC 8.8.1. Trimmed warnings.
  • Loading branch information
sigrlami authored Jan 12, 2020
2 parents ccbfb1d + 367885b commit 7ff345f
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 22 deletions.
13 changes: 13 additions & 0 deletions .ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:set -XNamedFieldPuns
:set -XOverloadedStrings
:set -XRank2Types
:set -XRecordWildCards
:set -XDoAndIfThenElse
:set -XOverloadedStrings
:set -XBangPatterns
:set -XViewPatterns
:set -XTypeOperators
:set -Wall
:set -fno-warn-name-shadowing
:set -i.
:set -itest
1 change: 0 additions & 1 deletion Database/SQLite/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ module Database.SQLite.Simple (
, Base.Error(..)
) where

import Control.Applicative
import Control.Exception
import Control.Monad (void, when, forM_)
import Control.Monad.Trans.Reader
Expand Down
3 changes: 1 addition & 2 deletions Database/SQLite/Simple/FromField.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module Database.SQLite.Simple.FromField
, returnError
) where

import Control.Applicative (Applicative, (<$>), pure)
import Control.Exception (SomeException(..), Exception)
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as B
Expand All @@ -44,7 +43,7 @@ import Data.Time (UTCTime, Day)
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import Data.Typeable (Typeable, typeOf)
import Data.Word (Word, Word8, Word16, Word32, Word64)
import Data.Word (Word8, Word16, Word32, Word64)
import GHC.Float (double2Float)

import Database.SQLite3 as Base
Expand Down
1 change: 0 additions & 1 deletion Database/SQLite/Simple/FromRow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module Database.SQLite.Simple.FromRow
, numFieldsRemaining
) where

import Control.Applicative (Applicative(..), (<$>))
import Control.Exception (SomeException(..))
import Control.Monad (replicateM)
import Control.Monad.Trans.State.Strict
Expand Down
2 changes: 0 additions & 2 deletions Database/SQLite/Simple/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

module Database.SQLite.Simple.Internal where

import Prelude hiding (catch)

import Control.Exception (Exception)
import Control.Monad
import Control.Applicative
Expand Down
1 change: 1 addition & 0 deletions Database/SQLite/Simple/Ok.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ instance Monad Ok where
Errors es >>= _ = Errors es
Ok a >>= f = f a

instance MonadFail Ok where
fail str = Errors [SomeException (ErrorCall str)]

-- | a way to reify a list of exceptions into a single exception
Expand Down
1 change: 0 additions & 1 deletion Database/SQLite/Simple/Time/Implementation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import Data.Bits ((.&.))
import Data.ByteString.Internal (w2c)
import Data.Char (isDigit, ord)
import Data.Fixed (Pico)
import Data.Monoid (Monoid(..))
import qualified Data.Text as T
import Data.Time hiding (getTimeZone, getZonedTime)
import Prelude hiding (take, (++))
Expand Down
2 changes: 1 addition & 1 deletion Database/SQLite/Simple/ToField.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import qualified Data.Text.Encoding as T
import Data.Time (Day, UTCTime)
import Data.Word (Word, Word8, Word16, Word32, Word64)
import Data.Word (Word8, Word16, Word32, Word64)
import GHC.Float

import Database.SQLite3 as Base
Expand Down
2 changes: 0 additions & 2 deletions Database/SQLite/Simple/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ module Database.SQLite.Simple.Types
) where

import Control.Arrow (first)
import Data.Monoid (Monoid(..))
import Data.Semigroup (Semigroup(..))
import Data.String (IsString(..))
import Data.Tuple.Only (Only(..))
import Data.Typeable (Typeable)
Expand Down
2 changes: 1 addition & 1 deletion sqlite-simple.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: sqlite-simple
Version: 0.4.16.0
Version: 0.4.16.1
Synopsis: Mid-Level SQLite client library
Description:
Mid-level SQLite client library, based on postgresql-simple.
Expand Down
2 changes: 0 additions & 2 deletions test/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module Errors (
, testErrorsExclusiveTransaction
) where

import Prelude hiding (catch)
import Control.Exception
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
Expand All @@ -22,7 +21,6 @@ import Data.Time (Day, UTCTime)

import Common
import Database.SQLite.Simple.Types (Null)
import Database.SQLite3 (SQLError)

-- The "length (show e) `seq` .." trickery below is to force evaluate
-- the contents of error messages. Another option would be to log
Expand Down
6 changes: 3 additions & 3 deletions test/ParamConv.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -Wno-overflowed-literals #-}
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}

module ParamConv (
Expand All @@ -13,7 +14,6 @@ module ParamConv (
, testParamConvComposite
, testParamNamed) where

import Control.Applicative
import Data.Int
import Data.Word
import Data.Time
Expand Down Expand Up @@ -133,10 +133,10 @@ testParamConvDateTime TestEnv{..} = TestCase $ do
-- TODO should _rows be forced to make sure parsers kick on the
-- returned data?
execute conn "INSERT INTO dt (t1,t2) VALUES (?,?)"
(read "2012-08-12" :: Day, read "2012-08-12 01:01:01" :: UTCTime)
(read "2012-08-12" :: Day, read "2012-08-12 01:01:01 UTC" :: UTCTime)
[_,(t1,t2)] <- query_ conn "SELECT t1,t2 from dt" :: IO [(Day, UTCTime)]
assertEqual "day" (read "2012-08-12" :: Day) t1
assertEqual "day" (read "2012-08-12 01:01:01" :: UTCTime) t2
assertEqual "day" (read "2012-08-12 01:01:01 UTC" :: UTCTime) t2


testParamConvBools :: TestEnv -> Test
Expand Down
9 changes: 4 additions & 5 deletions test/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
-- orphan IsString instance in older byteString
import Data.ByteString.Lazy.Char8 ()
import Data.Monoid ((<>), mappend, mempty)
import qualified Data.Text as T
import qualified Data.Text.Lazy as LT
import Data.Time (UTCTime, Day)
Expand Down Expand Up @@ -86,7 +85,7 @@ testSimpleParams TestEnv{..} = TestCase $ do
testSimpleTime :: TestEnv -> Test
testSimpleTime TestEnv{..} = TestCase $ do
let timestr = "2012-08-20 20:19:58"
time = read timestr :: UTCTime
time = read (timestr ++ " UTC") :: UTCTime
execute_ conn "CREATE TABLE time (t TIMESTAMP)"
execute conn "INSERT INTO time (t) VALUES (?)" (Only time)
[Only t] <- query_ conn "SELECT * FROM time" :: IO [Only UTCTime]
Expand Down Expand Up @@ -116,7 +115,7 @@ testSimpleTime TestEnv{..} = TestCase $ do
testSimpleTimeFract :: TestEnv -> Test
testSimpleTimeFract TestEnv{..} = TestCase $ do
let timestr = "2012-08-17 08:00:03.256887"
time = read timestr :: UTCTime
time = read (timestr ++ " UTC") :: UTCTime
-- Try inserting timestamp directly as a string
execute_ conn "CREATE TABLE timefract (t TIMESTAMP)"
execute_ conn (Query (T.concat ["INSERT INTO timefract (t) VALUES ('", T.pack timestr, "')"]))
Expand Down Expand Up @@ -177,7 +176,7 @@ testSimpleUTCTime TestEnv{..} = TestCase $ do

makeReadable s =
let s' = if T.length s < T.length "YYYY-MM-DD HH:MM:SS" then T.append s ":00" else s
in T.unpack . T.replace "T" " " $ s'
in (T.unpack . T.replace "T" " " $ s') ++ " UTC"

testSimpleUTCTimeTZ :: TestEnv -> Test
testSimpleUTCTimeTZ TestEnv{..} = TestCase $ do
Expand Down Expand Up @@ -212,7 +211,7 @@ testSimpleUTCTimeParams TestEnv{..} = TestCase $ do
mapM_ assertResult times
where
assertResult tstr = do
let utct = read . T.unpack $ tstr :: UTCTime
let utct = read . (++ " UTC") . T.unpack $ tstr :: UTCTime
[Only t] <- query conn "SELECT ?" (Only utct) :: IO [Only T.Text]
assertEqual "UTCTime" tstr t

Expand Down
1 change: 0 additions & 1 deletion test/TestImports.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module TestImports (
) where

-- Test file to test that we can do most things with a single import
import Control.Applicative
import qualified Data.Text as T

import Common
Expand Down

0 comments on commit 7ff345f

Please sign in to comment.