Skip to content

Commit 6bb5866

Browse files
committed
sort imported items and align equal signs
1 parent 949f87e commit 6bb5866

6 files changed

Lines changed: 29 additions & 29 deletions

File tree

src/File.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import Control.Monad (guard, when)
66
import Data.ByteString.Lazy qualified as ByteString
77
import Data.ByteString.Lazy.Char8 qualified as Char8
88
import Data.Char (isSpace)
9-
import Data.List.NonEmpty (NonEmpty((:|)), (<|), head, tail,
10-
uncons, prependList, toList)
9+
import Data.List.NonEmpty (NonEmpty((:|)), head, prependList, tail, toList,
10+
uncons, (<|))
1111
import Data.Tuple.Extra (second)
12-
import Prelude hiding (head, tail)
1312
import System.Exit (exitFailure)
1413
import System.IO
14+
import Prelude hiding (head, tail)
1515

1616
import Option
1717

@@ -40,11 +40,11 @@ readFromFile opts handle = do
4040
return (columns, body)
4141
where joinMultiLines (cs:ds:css) | valid True cs = cs <| joinMultiLines (ds:css)
4242
| otherwise = joinMultiLines $ (cs ++ "\n" ++ ds) : css
43-
where valid False ('"':'"':xs) = valid False xs
43+
where valid False ('"':'"':xs) = valid False xs
4444
valid False ('\\':'"':xs) = valid False xs
45-
valid b ('"':xs) = valid (not b) xs
46-
valid b (_:xs) = valid b xs
47-
valid b "" = b
45+
valid b ('"':xs) = valid (not b) xs
46+
valid b (_:xs) = valid b xs
47+
valid b "" = b
4848
joinMultiLines (cs:css) = cs :| css
4949
joinMultiLines [] = "" :| []
5050

src/Main.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module Main where
22

33
import Control.Applicative ((<|>))
4-
import Control.Monad (forM_, guard, when, unless)
4+
import Control.Monad (forM_, guard, unless, when)
55
import Data.Char (isSpace)
6-
import Data.List (isSuffixOf, intercalate, transpose)
6+
import Data.List (intercalate, isSuffixOf, transpose)
77
import Data.Map qualified as Map
88
import Data.Maybe (fromMaybe, isJust)
9-
import Data.Set as Set ((\\), fromList, union)
9+
import Data.Set as Set (fromList, union, (\\))
1010
import Database.SQLite.Simple qualified as SQLite
11-
import Options.Applicative (execParser, helper, info, fullDesc, header)
11+
import Options.Applicative (execParser, fullDesc, header, helper, info)
1212
import System.Exit (exitFailure)
1313
import System.IO
1414
import Text.Read (readMaybe)
@@ -56,7 +56,7 @@ fetchQuery opts = do
5656
hPutStrLn stderr "Can't provide both a query file and a query on the command line."
5757
exitFailure
5858
query <- fromMaybe "" <$> case opts.query of
59-
Just q -> return (Just q)
59+
Just q -> return (Just q)
6060
Nothing -> mapM readFile opts.queryFile
6161
when (all isSpace query) $ do
6262
hPutStrLn stderr "Query cannot be empty."

src/Option.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import Paths_qhs qualified as QHS
88
-- | Command options
99
data Option =
1010
Option {
11-
skipHeader :: Bool,
12-
outputHeader :: Bool,
13-
delimiter :: Maybe String,
14-
tabDelimited :: Bool,
15-
pipeDelimited :: Bool,
16-
outputDelimiter :: Maybe String,
17-
tabDelimitedOutput :: Bool,
18-
pipeDelimitedOutput :: Bool,
11+
skipHeader :: Bool,
12+
outputHeader :: Bool,
13+
delimiter :: Maybe String,
14+
tabDelimited :: Bool,
15+
pipeDelimited :: Bool,
16+
outputDelimiter :: Maybe String,
17+
tabDelimitedOutput :: Bool,
18+
pipeDelimitedOutput :: Bool,
1919
keepLeadingWhiteSpace :: Bool,
20-
gzipped :: Bool,
21-
queryFile :: Maybe String,
22-
query :: Maybe String
20+
gzipped :: Bool,
21+
queryFile :: Maybe String,
22+
query :: Maybe String
2323
}
2424

2525
-- | Option parser

src/Parser.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extractTableNames :: String -> FilePath -> Either Parse.ParseError [String]
6767
extractTableNames query path = everything (++) ([] `mkQ` tableNames)
6868
<$> Parse.parseQueryExpr Dialect.mysql (Text.pack path) Nothing (Text.pack query)
6969
where tableNames (Syntax.TRSimple (name:_)) = fromName name
70-
tableNames _ = []
70+
tableNames _ = []
7171
fromName (Syntax.Name _ name) = [Text.unpack name]
7272

7373
errorString :: Parse.ParseError -> String

src/SQL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module SQL (open, close, createTable, insertRow, execute) where
22

3-
import Control.Exception (try, SomeException)
3+
import Control.Exception (SomeException, try)
44
import Control.Monad (forM)
55
import Data.List (intercalate)
66
import Data.String (fromString)

src/SQLType.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ data SQLType = SQLChar | SQLInt
1616

1717
instance Show SQLType where
1818
show SQLChar = "CHAR"
19-
show SQLInt = "INTEGER"
19+
show SQLInt = "INTEGER"
2020

2121
instance ToField (SQLType, String) where
2222
toField (SQLChar, cs) = SQLText $ Text.pack cs
23-
toField (SQLInt, cs) = maybe SQLNull SQLFloat $ readMaybe cs
23+
toField (SQLInt, cs) = maybe SQLNull SQLFloat $ readMaybe cs
2424

2525
data Any = AnyDouble Double | AnyInt Int | AnyString String | AnyNull
2626
deriving Eq
@@ -40,9 +40,9 @@ instance IsString Any where
4040

4141
instance Show Any where
4242
show (AnyDouble d) = show d
43-
show (AnyInt i) = show i
43+
show (AnyInt i) = show i
4444
show (AnyString s) = s
45-
show AnyNull = ""
45+
show AnyNull = ""
4646

4747
fromColumnsAndEntries :: [String] -> [[String]] -> ([String], [[Any]])
4848
fromColumnsAndEntries columns xs = (columns, map (map fromString) xs)

0 commit comments

Comments
 (0)