From 6650bec38ac6fd7b44c50a72402ff81236c4f2ea Mon Sep 17 00:00:00 2001 From: Maxim Koltsov Date: Mon, 19 Apr 2021 17:46:00 +0300 Subject: [PATCH 1/3] Support compilation with GHC 9 --- src/Codec/Xlsx/Formatted.hs | 2 +- src/Codec/Xlsx/Lens.hs | 6 +++--- src/Codec/Xlsx/Types/Drawing.hs | 30 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Codec/Xlsx/Formatted.hs b/src/Codec/Xlsx/Formatted.hs index c1b21715..9d39fc36 100644 --- a/src/Codec/Xlsx/Formatted.hs +++ b/src/Codec/Xlsx/Formatted.hs @@ -340,7 +340,7 @@ formatCell (row, col) cell = do 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}) diff --git a/src/Codec/Xlsx/Lens.hs b/src/Codec/Xlsx/Lens.hs index 67e8bcb0..f15f6912 100644 --- a/src/Codec/Xlsx/Lens.hs +++ b/src/Codec/Xlsx/Lens.hs @@ -84,7 +84,7 @@ ixCellRC i = wsCells . ix i -- | 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 @@ atCellRC i = wsCells . at i -- | 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 @@ cellValueAtRC i = atCell i . non def . cellValue -- | 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 diff --git a/src/Codec/Xlsx/Types/Drawing.hs b/src/Codec/Xlsx/Types/Drawing.hs index 9e42ae8e..1452edf0 100644 --- a/src/Codec/Xlsx/Types/Drawing.hs +++ b/src/Codec/Xlsx/Types/Drawing.hs @@ -217,6 +217,21 @@ data Anchor p g = Anchor } 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 @@ -233,21 +248,6 @@ simpleAnchorXY (x, y) sz 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 -------------------------------------------------------------------------------} From 79b078476653e30be7e399bdf8850c6747fa64ce Mon Sep 17 00:00:00 2001 From: Kirill Zaborsky Date: Sat, 19 Jun 2021 17:26:12 +0300 Subject: [PATCH 2/3] Make nightly to use GHC9 and use it in github actions --- .github/workflows/workflow.yml | 4 +++- stack-nightly.yaml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index e0257d52..c85c70ae 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -27,7 +27,9 @@ jobs: - os: ubuntu-latest stack-yaml: stack-lts-17.yaml extra-args: "" - + - os: ubuntu-latest + stack-yaml: stack-nightly.yaml + extra-args: "" steps: - name: Clone project uses: actions/checkout@v2 diff --git a/stack-nightly.yaml b/stack-nightly.yaml index 8dba7f85..130b7172 100644 --- a/stack-nightly.yaml +++ b/stack-nightly.yaml @@ -1,3 +1,3 @@ -resolver: nightly-2019-10-31 +resolver: nightly-2021-06-19 packages: - '.' From a3574dd175bec3d5f2b63c08c1fb303452c74a24 Mon Sep 17 00:00:00 2001 From: Kirill Zaborsky Date: Sat, 19 Jun 2021 17:27:46 +0300 Subject: [PATCH 3/3] Add GHC9.0.1 to "tested-with" --- xlsx.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlsx.cabal b/xlsx.cabal index c52c7d7a..98e972c3 100644 --- a/xlsx.cabal +++ b/xlsx.cabal @@ -26,7 +26,7 @@ Maintainer: qrilka@gmail.com Category: Codec Build-type: Simple -Tested-with: GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4 +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