cointracking-imports 0.1.0.1 → 0.1.0.2
raw patch · 4 files changed
+29/−8 lines, 4 filesdep ~textPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: text
API changes (from Hackage documentation)
+ Web.CoinTracking.Imports.Types: data ColumnIndex
+ Web.CoinTracking.Imports.Types: data RowIndex
- Web.CoinTracking.Imports: writeXlsxRow :: Worksheet -> Int -> CTImportData -> Worksheet
+ Web.CoinTracking.Imports: writeXlsxRow :: Worksheet -> RowIndex -> CTImportData -> Worksheet
Files
- CHANGELOG.md +6/−0
- cointracking-imports.cabal +5/−5
- src/Web/CoinTracking/Imports.hs +3/−3
- src/Web/CoinTracking/Imports/Types.hs +15/−0
CHANGELOG.md view
@@ -3,6 +3,12 @@ ## master +## v0.1.0.2++* Support breaking changes in `xlsx-1.1.0`.+* Bump dependency versions.++ ## v0.1.0.1 * Remove newlines at end of generated CSV files to fix non-fatal errors when
cointracking-imports.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: cointracking-imports-version: 0.1.0.1+version: 0.1.0.2 synopsis: Generate CSV & XLSX files for importing into CoinTracking. description: @cointracking-imports@ is a library for generating CSV & XLSX files to use with <https://cointracking.info CoinTracking>'s Import feature. You@@ -57,9 +57,9 @@ , filepath ==1.* , lens >=3.0.4 && <6 , scientific <1- , text <2+ , text <3 , time <2- , xlsx <1+ , xlsx <2 if impl(ghc >= 8.0) ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints else@@ -96,9 +96,9 @@ , tasty , tasty-hedgehog , tasty-hunit- , text <2+ , text <3 , time <2- , xlsx <1+ , xlsx <2 if impl(ghc >= 8.0) ghc-options: -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints else
src/Web/CoinTracking/Imports.hs view
@@ -117,7 +117,7 @@ in fromXlsx createdTime book where -- | Indexed fold from the left.- ixFoldl :: (b -> Int -> a -> b) -> b -> [a] -> b+ ixFoldl :: (b -> RowIndex -> a -> b) -> b -> [a] -> b ixFoldl f initial = fst . foldl' (\(b, i) a -> (f b i a, i + 1)) (initial, 0) @@ -141,12 +141,12 @@ & writeColumn 10 "Comment" & writeColumn 11 "Date" where- writeColumn :: Int -> T.Text -> Worksheet -> Worksheet+ writeColumn :: ColumnIndex -> T.Text -> Worksheet -> Worksheet writeColumn c t s = s & cellValueAt (2, c) ?~ CellText t -- | Write a 'CTImportData' to the given row(1-indexed) of the worksheet.-writeXlsxRow :: Worksheet -> Int -> CTImportData -> Worksheet+writeXlsxRow :: Worksheet -> RowIndex -> CTImportData -> Worksheet writeXlsxRow sheet row CTImportData {..} = sheet & (cellValueAt (row, 1) ?~ CellText (renderTransactionType ctidType))
src/Web/CoinTracking/Imports/Types.hs view
@@ -2,6 +2,7 @@ imports. -}+{-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-} module Web.CoinTracking.Imports.Types ( CTImportData(..)@@ -9,8 +10,15 @@ , renderTransactionType , Amount(..) , Currency(..)+ , RowIndex+ , ColumnIndex ) where +#if MIN_VERSION_xlsx(1, 1, 0)+import Codec.Xlsx ( ColumnIndex+ , RowIndex+ )+#endif import Data.Csv ( Field , ToField(..) , ToRecord(..)@@ -28,6 +36,13 @@ import GHC.Generics ( Generic ) import qualified Data.Text as T+++#if MIN_VERSION_xlsx(1, 1, 0)+#else+type RowIndex = Int+type ColumnIndex = Int+#endif -- | Represents a single row in an export. data CTImportData = CTImportData