mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-25 03:13:25 +03:00
Removed Data.Vector
This commit is contained in:
parent
1272e8e758
commit
cf281577a3
@ -59,8 +59,8 @@ import Text.CSV (parseCSV, CSV)
|
||||
import qualified Data.Csv as DSCV
|
||||
import Test.HUnit hiding (State)
|
||||
import qualified Data.Csv as DCSV
|
||||
import Data.Vector (Vector)
|
||||
import Data.Foldable
|
||||
import Data.Either
|
||||
import Text.Megaparsec hiding (parse)
|
||||
import Text.Megaparsec.Char
|
||||
import qualified Text.Parsec as Parsec
|
||||
@ -71,8 +71,6 @@ import Hledger.Utils.UTF8IOCompat (getContents)
|
||||
import Hledger.Utils
|
||||
import Hledger.Read.Common (Reader(..),InputOpts(..),amountp, statusp, genericSourcePos)
|
||||
|
||||
import Data.Either
|
||||
|
||||
|
||||
type CSV = [Record]
|
||||
|
||||
@ -195,11 +193,13 @@ parseCassava path content =
|
||||
case parseResult of
|
||||
Left msg -> Left $ CSVError msg
|
||||
Right a -> Right a
|
||||
where parseResult = fmap fromCassavaToCSV $ DCSV.decode DCSV.NoHeader (C.pack content)
|
||||
where parseResult = fmap parseResultToCsv $ DCSV.decode DCSV.NoHeader (C.pack content)
|
||||
|
||||
fromCassavaToCSV :: (Vector (Vector C.ByteString)) -> CSV
|
||||
fromCassavaToCSV records = toList (toCSVRecord <$> records)
|
||||
where toCSVRecord fields = toList (C.unpack <$> fields)
|
||||
parseResultToCsv :: (Foldable t, Functor t) => t (t C.ByteString) -> CSV
|
||||
parseResultToCsv = toListList . unpackFields
|
||||
where
|
||||
toListList = toList . fmap toList
|
||||
unpackFields = (fmap . fmap) C.unpack
|
||||
|
||||
printCSV :: CSV -> String
|
||||
printCSV records = unlines (printRecord `map` records)
|
||||
|
@ -2,7 +2,7 @@
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 642c6b4607959713188c82341f1050872ec6111a64f8e4b4cc1c1630da585baf
|
||||
-- hash: b808d840bfd7de5e860adb6ac41ec6bcee061cebcff87b4a1b87d2a46c58b0bf
|
||||
|
||||
name: hledger-lib
|
||||
version: 1.10.99
|
||||
@ -112,7 +112,6 @@ library
|
||||
, bytestring
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, csv
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
@ -209,7 +208,6 @@ test-suite doctests
|
||||
, bytestring
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, csv
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
@ -307,7 +305,6 @@ test-suite easytests
|
||||
, bytestring
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, csv
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
@ -406,7 +403,6 @@ test-suite hunittests
|
||||
, bytestring
|
||||
, cmdargs >=0.10
|
||||
, containers
|
||||
, csv
|
||||
, data-default >=0.5
|
||||
, deepseq
|
||||
, directory
|
||||
|
@ -48,7 +48,6 @@ dependencies:
|
||||
- call-stack
|
||||
- cmdargs >=0.10
|
||||
- containers
|
||||
- csv
|
||||
- cassava
|
||||
- data-default >=0.5
|
||||
- Decimal
|
||||
|
Loading…
Reference in New Issue
Block a user