Bryan O'Sullivan  committed bd544c9

Tidy imports.

  • Participants
  • Parent commits e541f62
  • Branches default
  • Tags

Comments (0)

Files changed (6)

File Database/MySQL/Simple.hs

     , formatQuery
     ) where
-import Control.Applicative
+import Blaze.ByteString.Builder (fromByteString, toByteString)
+import Control.Applicative ((<$>), pure)
+import Control.DeepSeq (NFData(..))
+import Control.Monad.Fix (fix)
+import Data.ByteString (ByteString)
 import Data.Int (Int64)
-import Control.DeepSeq
-import Control.Monad.Fix
-import Blaze.ByteString.Builder
+import Data.Monoid (mappend, mempty)
+import Database.MySQL.Base (Connection)
+import Database.MySQL.Simple.Param (Action(..), inQuotes)
+import Database.MySQL.Simple.QueryParams (QueryParams(..))
+import Database.MySQL.Simple.QueryResults (QueryResults(..))
+import Database.MySQL.Simple.Types (Query(..))
 import qualified Data.ByteString.Char8 as B
-import Data.ByteString (ByteString)
-import Data.Monoid
-import Database.MySQL.Base (Connection)
 import qualified Database.MySQL.Base as Base
-import Database.MySQL.Simple.Param
-import Database.MySQL.Simple.QueryParams
-import Database.MySQL.Simple.QueryResults
-import Database.MySQL.Simple.Types
 formatQuery :: QueryParams q => Connection -> Query -> q -> IO ByteString
 formatQuery conn (Query template) qs

File Database/MySQL/Simple/Orphans.hs

 module Database.MySQL.Simple.Orphans () where
+import Control.DeepSeq (NFData(..))
 import Data.Time.Calendar (Day(..))
 import Data.Time.Clock (UTCTime(..))
 import Data.Time.LocalTime (TimeOfDay(..))
 import qualified Data.ByteString.Internal as SB
 import qualified Data.ByteString.Lazy.Internal as LB
-import Control.DeepSeq (NFData(..))
 instance NFData SB.ByteString where
     rnf (SB.PS _ _ _) = ()

File Database/MySQL/Simple/Param.hs

 import Blaze.ByteString.Builder (Builder, fromByteString, toByteString)
 import Blaze.Text (integral, double, float)
 import Data.ByteString (ByteString)
+import Data.Int (Int8, Int16, Int32, Int64)
 import Data.Monoid (mappend)
-import Database.MySQL.Simple.Types (Null)
-import Data.Int (Int8, Int16, Int32, Int64)
 import Data.Time.Calendar (Day, showGregorian)
 import Data.Time.Clock (UTCTime)
+import Data.Time.Format (formatTime)
 import Data.Time.LocalTime (TimeOfDay)
-import Data.Time.Format (formatTime)
 import Data.Word (Word, Word8, Word16, Word32, Word64)
+import Database.MySQL.Simple.Types (Null)
 import System.Locale (defaultTimeLocale)
 import qualified Blaze.ByteString.Builder.Char.Utf8 as Utf8
 import qualified Data.ByteString as SB

File Database/MySQL/Simple/QueryParams.hs

     ) where
-import Database.MySQL.Simple.Param
-import Database.MySQL.Simple.Types
+import Database.MySQL.Simple.Param (Action(..), Param(..))
+import Database.MySQL.Simple.Types (Only(..))
 class QueryParams a where
     renderParams :: a -> [Action]

File Database/MySQL/Simple/QueryResults.hs

     ) where
 import Control.DeepSeq (NFData(..))
+import Control.Exception (throw)
 import Data.ByteString (ByteString)
-import Database.MySQL.Base.Types
-import Database.MySQL.Simple.Result
-import Database.MySQL.Simple.Types
+import Database.MySQL.Base.Types (Field)
+import Database.MySQL.Simple.Result (ResultError(..), Result(..))
+import Database.MySQL.Simple.Types (Only(..))
 class (NFData a) => QueryResults a where
     convertResults :: [Field] -> [Maybe ByteString] -> a
     convertResults fs vs  = convError fs vs
 convError :: [Field] -> [Maybe ByteString] -> a
-convError = error "convError"
+convError fs vs = throw $ ConversionFailed
+                  (show (length fs) ++ " columns left in result")
+                  (show (length vs) ++ " values left in row")
+                  "mismatch between number of columns to convert"

File Database/MySQL/Simple/Result.hs

 #include "MachDeps.h"
-import Data.Typeable
-import Database.MySQL.Simple.Orphans ()
+import Control.Applicative ((<$>), (<*>), (<*), pure)
 import Control.DeepSeq (NFData)
-import Control.Applicative
-import Control.Exception
+import Control.Exception (Exception, throw)
+import Data.Attoparsec.Char8 hiding (Result)
+import Data.Bits ((.&.), (.|.), shiftL)
 import Data.ByteString (ByteString)
-import Database.MySQL.Base.Types
-import Data.Attoparsec.Char8 hiding (Result)
-import Data.Bits
+import Data.Int (Int8, Int16, Int32, Int64)
+import Data.List (foldl')
+import Data.Ratio (Ratio)
 import Data.Time.Calendar (Day, fromGregorian)
 import Data.Time.Clock (UTCTime)
+import Data.Time.Format (parseTime)
 import Data.Time.LocalTime (TimeOfDay, makeTimeOfDayValid)
+import Data.Typeable (TypeRep, Typeable, typeOf)
+import Data.Word (Word, Word8, Word16, Word32, Word64)
+import Database.MySQL.Base.Types (Field(..), Type(..))
+import Database.MySQL.Simple.Orphans ()
 import System.Locale (defaultTimeLocale)
-import Data.Int (Int8, Int16, Int32, Int64)
-import Data.Word (Word, Word8, Word16, Word32, Word64)
-import Data.Ratio (Ratio)
-import Data.List
 import qualified Data.ByteString as SB
 import qualified Data.ByteString.Char8 as B8
 import qualified Data.ByteString.Lazy as LB
 import qualified Data.Text as ST
 import qualified Data.Text.Encoding as ST
 import qualified Data.Text.Lazy as LT
-import Data.Time.Format (parseTime)
 data ResultError = Incompatible { errSourceType :: String
                                 , errDestType :: String