packages feed

xlsx 0.8.3 → 0.8.4

raw patch · 8 files changed

+81/−48 lines, 8 filesdep ~basedep ~mtldep ~safe

Dependency ranges changed: base, mtl, safe

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.8.4+------------+* dropped support for GHC 8.0.* and 8.2.* and added support for GHC 8.10.* and 9.0.*+ 0.8.3 ------------ * compatibility with lens-5.0
src/Codec/Xlsx/Formatted.hs view
@@ -340,7 +340,7 @@     mapM go block   where     go :: ((Int, Int), FormattedCell) -> State FormattingState ((Int, Int), Cell)-    go (pos, c@ FormattedCell{..}) = do+    go (pos, c@FormattedCell{..}) = do       styleId <- cellStyleId c       return (pos, _formattedCell{_cellStyle = styleId}) 
src/Codec/Xlsx/Lens.hs view
@@ -84,7 +84,7 @@ -- | lens to access cell in a worksheet using more traditional -- x+y coordinates ixCellXY :: (Int, Int) -> Traversal' Worksheet Cell-ixCellXY = ixCellRC . swap+ixCellXY i = ixCellRC $ swap i  -- | accessor that can read, write or delete cell in a worksheet -- synonym of 'atCellRC' so uses row+column index@@ -98,7 +98,7 @@ -- | lens to read, write or delete cell in a worksheet -- using more traditional x+y or row+column index atCellXY :: (Int, Int) -> Lens' Worksheet (Maybe Cell)-atCellXY = atCellRC . swap+atCellXY i = atCellRC $ swap i  -- | lens to read, write or delete cell value in a worksheet -- with row+column coordinates, synonym for 'cellValueRC'@@ -113,4 +113,4 @@ -- | lens to read, write or delete cell value in a worksheet -- using traditional x+y coordinates cellValueAtXY :: (Int, Int) -> Lens' Worksheet (Maybe CellValue)-cellValueAtXY = cellValueAtRC . swap+cellValueAtXY i = cellValueAtRC $ swap i
src/Codec/Xlsx/Types/Drawing.hs view
@@ -217,6 +217,21 @@     } deriving (Eq, Show, Generic) instance (NFData p, NFData g) => NFData (Anchor p g) +data GenericDrawing p g = Drawing+    { _xdrAnchors :: [Anchor p g]+    } deriving (Eq, Show, Generic)+instance (NFData p, NFData g) => NFData (GenericDrawing p g)++-- See 20.5.2.35 "wsDr (Worksheet Drawing)" (p. 3176)+type Drawing = GenericDrawing FileInfo ChartSpace++type UnresolvedDrawing = GenericDrawing RefId RefId++makeLenses ''Anchor+makeLenses ''DrawingObject+makeLenses ''BlipFillProperties+makeLenses ''GenericDrawing+ -- | simple drawing object anchoring using one cell as a top lelft -- corner and dimensions of that object simpleAnchorXY :: (Int, Int) -- ^ x+y coordinates of a cell used as@@ -232,21 +247,6 @@   , _anchObject = obj   , _anchClientData = def   }--data GenericDrawing p g = Drawing-    { _xdrAnchors :: [Anchor p g]-    } deriving (Eq, Show, Generic)-instance (NFData p, NFData g) => NFData (GenericDrawing p g)---- See 20.5.2.35 "wsDr (Worksheet Drawing)" (p. 3176)-type Drawing = GenericDrawing FileInfo ChartSpace--type UnresolvedDrawing = GenericDrawing RefId RefId--makeLenses ''Anchor-makeLenses ''DrawingObject-makeLenses ''BlipFillProperties-makeLenses ''GenericDrawing  {-------------------------------------------------------------------------------   Default instances
test/DrawingTests.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} module DrawingTests@@ -6,7 +7,11 @@   , testLineChartSpace   ) where +#ifdef USE_MICROLENS+import Lens.Micro+#else import Control.Lens+#endif import Data.ByteString.Lazy (ByteString) import Test.Tasty (testGroup, TestTree) import Test.Tasty.HUnit (testCase)
test/Main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE RecordWildCards   #-}@@ -6,7 +7,12 @@   ( main   ) where +#ifdef USE_MICROLENS+import Lens.Micro+import Lens.Micro.Mtl+#else import Control.Lens+#endif import Control.Monad.State.Lazy import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as LB@@ -267,8 +273,8 @@  withUnderline :: FontUnderline -> SharedStringTable -> SharedStringTable withUnderline u (SharedStringTable [text, XlsxRichText [rich1, RichTextRun (Just props) val]]) =-    let newprops = props & runPropertiesUnderline .~ Just u  -    in SharedStringTable [text, XlsxRichText [rich1, RichTextRun (Just newprops) val]] +    let newprops = props & runPropertiesUnderline .~ Just u+    in SharedStringTable [text, XlsxRichText [rich1, RichTextRun (Just newprops) val]]  testSharedStringTable :: SharedStringTable testSharedStringTable = SharedStringTable $ V.fromList items@@ -311,34 +317,42 @@              , _richTextRunText = "Why such high expense?"}]  testStrings :: ByteString-testStrings = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\-  \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\-  \<si><t>plain text</t></si>\-  \<si><r><t>Just </t></r><r><rPr><b /><i />\-  \<sz val=\"10\"/><rFont val=\"Arial\"/><family val=\"2\"/></rPr><t>example</t></r></si>\-  \</sst>"+testStrings = [r|+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+  <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">+  <si><t>plain text</t></si>+  <si><r><t>Just </t></r><r><rPr><b /><i />+  <sz val="10"/><rFont val="Arial"/><family val="2"/></rPr><t>example</t></r></si>+  </sst>+|]  testStringsWithSingleUnderline :: ByteString-testStringsWithSingleUnderline = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\-  \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\-  \<si><t>plain text</t></si>\-  \<si><r><t>Just </t></r><r><rPr><b /><i /><u />\-  \<sz val=\"10\"/><rFont val=\"Arial\"/><family val=\"2\"/></rPr><t>example</t></r></si>\-  \</sst>"+testStringsWithSingleUnderline = [r|+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+  <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">+  <si><t>plain text</t></si>+  <si><r><t>Just </t></r><r><rPr><b /><i /><u />+  <sz val="10"/><rFont val="Arial"/><family val="2"/></rPr><t>example</t></r></si>+  </sst>+|]  testStringsWithDoubleUnderline :: ByteString-testStringsWithDoubleUnderline = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\-  \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\-  \<si><t>plain text</t></si>\-  \<si><r><t>Just </t></r><r><rPr><b /><i /><u val=\"double\"/>\-  \<sz val=\"10\"/><rFont val=\"Arial\"/><family val=\"2\"/></rPr><t>example</t></r></si>\-  \</sst>"+testStringsWithDoubleUnderline = [r|+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+  <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">+  <si><t>plain text</t></si>+  <si><r><t>Just </t></r><r><rPr><b /><i /><u val="double"/>+  <sz val="10"/><rFont val="Arial"/><family val="2"/></rPr><t>example</t></r></si>+  </sst>+|]  testStringsWithEmpty :: ByteString-testStringsWithEmpty = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\-  \<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"2\" uniqueCount=\"2\">\-  \<si><t/></si>\-  \</sst>"+testStringsWithEmpty = [r|+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>+  <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">+  <si><t/></si>+  </sst>+|]  testComments :: ByteString testComments = [r|@@ -495,13 +509,13 @@     cellXf2 = def         { _cellXfApplyNumberFormat = Just True         , _cellXfNumFmtId          = Just 164 }-  + testFormatWorkbook :: Xlsx testFormatWorkbook = formatWorkbook sheets minimalStyleSheet   where     sheetNames = ["Sheet1", "Sheet2"]     testFormattedCellMap1 = M.fromList [((1,1), (def & formattedCell . cellValue ?~ CellText "text at A1 Sheet1"))]-      +     testFormattedCellMap2 = M.fromList [((2,3), (def & formattedCell . cellValue ?~ CellDouble 1.23456                                                  & formattedFormat . formatNumberFormat ?~ (UserNumberFormat "DD.MM.YYYY")))]     sheets = zip sheetNames [testFormattedCellMap1, testFormattedCellMap2]
test/PivotTableTests.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} module PivotTableTests@@ -6,7 +7,11 @@   , testPivotSrcCells   ) where +#ifdef USE_MICROLENS+import Lens.Micro+#else import Control.Lens+#endif import Data.ByteString.Lazy (ByteString) import qualified Data.Map as M import Data.Maybe (mapMaybe)
xlsx.cabal view
@@ -1,6 +1,6 @@ Name:                xlsx -Version:             0.8.3+Version:             0.8.4  Synopsis:            Simple and incomplete Excel file parser/writer Description:@@ -26,7 +26,7 @@  Category:            Codec Build-type:          Simple-Tested-with:         GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.5, GHC == 8.8.1+Tested-with:         GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4, GHC == 9.0.1 Cabal-version:       >=1.10  Flag microlens@@ -137,7 +137,6 @@                , containers                , Diff >= 0.3.0                , groom-               , lens >= 3.8 && < 5.1                , mtl                , raw-strings-qq                , smallcheck@@ -149,6 +148,12 @@                , vector                , xlsx                , xml-conduit >= 1.1.0+  if flag(microlens)+    Build-depends:     microlens    >= 0.4 && < 0.5+                     , microlens-mtl+    cpp-options: -DUSE_MICROLENS+  else+    Build-depends:     lens         >= 3.8 && < 5.1   Default-Language:     Haskell2010  source-repository head