Skip to content

Commit c3e66f7

Browse files
committed
format xlsx
1 parent 0438dff commit c3e66f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+8561
-7075
lines changed

nix/tools.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ with pkgs; let
3434
ormoluFormat = pkgs.writeShellApplication {
3535
name = "ormolu-format";
3636
text = ''
37-
${ormolu}/bin/ormolu --mode inplace \
38-
"$(find . -name '*.hs' -not -path './dist*')"
37+
find . -name '*.hs' -not -path './dist*' -print0 | \
38+
xargs -0 ${ormolu}/bin/ormolu --mode inplace
3939
'';
4040
};
4141
ormoluTest = pkgs.writeShellScriptBin "ormolu-test" ''

pub/xlsx/Setup.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import Distribution.Simple
2+
23
main = defaultMain

pub/xlsx/benchmarks/Main.hs

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE OverloadedStrings #-}
2+
23
module Main (main) where
34

45
import Codec.Xlsx
@@ -17,32 +18,44 @@ import Data.Maybe
1718
main :: IO ()
1819
main = do
1920
let filename = "data/testInput.xlsx"
20-
-- "data/6000.rows.x.26.cols.xlsx"
21+
-- "data/6000.rows.x.26.cols.xlsx"
2122
bs <- BS.readFile filename
2223
let bs' = LB.fromStrict bs
2324
parsed :: Xlsx
2425
parsed = toXlsxFast bs'
25-
idx <- fmap (fromMaybe (error "ix not found")) $ runXlsxM filename $ makeIndexFromName "Sample list"
26+
idx <-
27+
fmap (fromMaybe (error "ix not found")) $
28+
runXlsxM filename $
29+
makeIndexFromName "Sample list"
2630
items <- runXlsxM filename $ collectItems idx
2731
deepseq (parsed, bs', idx, items) (pure ())
2832
defaultMain
2933
[ bgroup
3034
"readFile"
31-
[ bench "with xlsx" $ nf toXlsx bs'
32-
, bench "with xlsx fast" $ nf toXlsxFast bs'
33-
, bench "with stream (counting)" $ nfIO $ runXlsxM filename $ countRowsInSheet idx
34-
, bench "with stream (reading)" $ nfIO $ runXlsxM filename $ readSheet idx (pure . rwhnf)
35-
]
36-
, bgroup
35+
[ bench "with xlsx" $ nf toXlsx bs',
36+
bench "with xlsx fast" $ nf toXlsxFast bs',
37+
bench "with stream (counting)" $ nfIO $ runXlsxM filename $ countRowsInSheet idx,
38+
bench "with stream (reading)" $
39+
nfIO $
40+
runXlsxM filename $
41+
readSheet idx (pure . rwhnf)
42+
],
43+
bgroup
3744
"writeFile"
38-
[ bench "with xlsx" $ nf (fromXlsx 0) parsed
39-
, bench "with stream (no sst)" $
40-
nfIO $ C.runConduit $
41-
void (writeXlsxWithSharedStrings defaultSettings mempty $ C.yieldMany $ view si_row <$> items)
42-
C..| C.fold
43-
, bench "with stream (sst)" $
44-
nfIO $ C.runConduit $
45-
void (writeXlsx defaultSettings $ C.yieldMany $ view si_row <$> items)
46-
C..| C.fold
45+
[ bench "with xlsx" $ nf (fromXlsx 0) parsed,
46+
bench "with stream (no sst)" $
47+
nfIO $
48+
C.runConduit $
49+
void
50+
( writeXlsxWithSharedStrings defaultSettings mempty $
51+
C.yieldMany $
52+
view si_row <$> items
53+
)
54+
C..| C.fold,
55+
bench "with stream (sst)" $
56+
nfIO $
57+
C.runConduit $
58+
void (writeXlsx defaultSettings $ C.yieldMany $ view si_row <$> items)
59+
C..| C.fold
4760
]
4861
]

pub/xlsx/src/Codec/Xlsx.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@
3535
-- > xlsx = def & atSheet "List1" ?~ sheet
3636
-- > L.writeFile "example.xlsx" $ fromXlsx ct xlsx
3737
module Codec.Xlsx
38-
( module X
39-
) where
38+
( module X,
39+
)
40+
where
4041

41-
import Codec.Xlsx.Types as X
42+
import Codec.Xlsx.Lens as X
4243
import Codec.Xlsx.Parser as X
44+
import Codec.Xlsx.Types as X
4345
import Codec.Xlsx.Writer as X
44-
import Codec.Xlsx.Lens as X

0 commit comments

Comments
 (0)