Skip to content

Commit

Permalink
Merge pull request #138 from maksbotan/maksbotan/ghc-9
Browse files Browse the repository at this point in the history
Support compilation with GHC 9
  • Loading branch information
qrilka authored Jun 19, 2021
2 parents 73d75c2 + a3574dd commit 831d5b0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Codec/Xlsx/Formatted.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
6 changes: 3 additions & 3 deletions src/Codec/Xlsx/Lens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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
30 changes: 15 additions & 15 deletions src/Codec/Xlsx/Types/Drawing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
-------------------------------------------------------------------------------}
Expand Down
2 changes: 1 addition & 1 deletion stack-nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
resolver: nightly-2019-10-31
resolver: nightly-2021-06-19
packages:
- '.'
2 changes: 1 addition & 1 deletion xlsx.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Maintainer: [email protected]

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
Expand Down

0 comments on commit 831d5b0

Please sign in to comment.