First function with cassava

This commit is contained in:
Luca Molteni 2018-06-08 16:06:21 +02:00
parent e92aeb151f
commit 0799383214
5 changed files with 107 additions and 9 deletions

View File

@ -54,6 +54,7 @@ import Safe
import System.Directory (doesFileExist)
import System.FilePath
import Text.CSV (parseCSV, CSV)
import qualified Data.Csv as DSCV
import Text.Megaparsec hiding (parse)
import Text.Megaparsec.Char
import qualified Text.Parsec as Parsec
@ -172,6 +173,10 @@ parseCsv path csvdata =
"-" -> liftM (parseCSV "(stdin)") getContents
_ -> return $ parseCSV path csvdata
parseCsv2 :: FilePath -> String -> IO (Either Parsec.ParseError CSV)
parseCsv2 = undefined
-- | Return the cleaned up and validated CSV data (can be empty), or an error.
validateCsv :: Int -> Either Parsec.ParseError CSV -> Either String [CsvRecord]
validateCsv _ (Left e) = Left $ show e

View File

@ -110,7 +110,6 @@ library
, base-compat-batteries >=0.10.1 && <0.11
, blaze-markup >=0.5.1
, bytestring
, call-stack
, cmdargs >=0.10
, containers
, csv
@ -208,7 +207,6 @@ test-suite doctests
, base-compat-batteries >=0.10.1 && <0.11
, blaze-markup >=0.5.1
, bytestring
, call-stack
, cmdargs >=0.10
, containers
, csv
@ -307,7 +305,6 @@ test-suite easytests
, base-compat-batteries >=0.10.1 && <0.11
, blaze-markup >=0.5.1
, bytestring
, call-stack
, cmdargs >=0.10
, containers
, csv
@ -339,3 +336,103 @@ test-suite easytests
build-depends:
semigroups ==0.18.*
default-language: Haskell2010
test-suite hunittests
type: exitcode-stdio-1.0
main-is: hunittests.hs
other-modules:
Hledger
Hledger.Data
Hledger.Data.Account
Hledger.Data.AccountName
Hledger.Data.Amount
Hledger.Data.Commodity
Hledger.Data.Dates
Hledger.Data.Journal
Hledger.Data.Ledger
Hledger.Data.MarketPrice
Hledger.Data.Period
Hledger.Data.PeriodicTransaction
Hledger.Data.Posting
Hledger.Data.RawOptions
Hledger.Data.StringFormat
Hledger.Data.Timeclock
Hledger.Data.Transaction
Hledger.Data.TransactionModifier
Hledger.Data.Types
Hledger.Query
Hledger.Read
Hledger.Read.Common
Hledger.Read.CsvReader
Hledger.Read.JournalReader
Hledger.Read.TimeclockReader
Hledger.Read.TimedotReader
Hledger.Reports
Hledger.Reports.BalanceHistoryReport
Hledger.Reports.BalanceReport
Hledger.Reports.BudgetReport
Hledger.Reports.EntriesReport
Hledger.Reports.MultiBalanceReports
Hledger.Reports.PostingsReport
Hledger.Reports.ReportOptions
Hledger.Reports.ReportTypes
Hledger.Reports.TransactionsReports
Hledger.Utils
Hledger.Utils.Color
Hledger.Utils.Debug
Hledger.Utils.Parse
Hledger.Utils.Regex
Hledger.Utils.String
Hledger.Utils.Test
Hledger.Utils.Text
Hledger.Utils.Tree
Hledger.Utils.UTF8IOCompat
Text.Megaparsec.Custom
Text.Tabular.AsciiWide
Paths_hledger_lib
hs-source-dirs:
./.
tests
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
build-depends:
Decimal
, Glob >=0.9
, HUnit
, ansi-terminal >=0.6.2.3
, array
, base >=4.8 && <4.12
, base-compat-batteries >=0.10.1 && <0.11
, blaze-markup >=0.5.1
, bytestring
, cmdargs >=0.10
, containers
, csv
, data-default >=0.5
, deepseq
, directory
, extra
, filepath
, hashtables >=1.2.3.1
, hledger-lib
, megaparsec >=6.4.1
, mtl
, mtl-compat
, old-time
, parsec >=3
, parser-combinators >=0.4.0
, pretty-show >=1.6.4
, regex-tdfa
, safe >=0.2
, split >=0.1
, tabular >=0.2
, test-framework
, test-framework-hunit
, text >=1.2
, time >=1.5
, transformers >=0.2
, uglymemo
, utf8-string >=0.3.5
if (!impl(ghc >= 8.0))
build-depends:
semigroups ==0.18.*
default-language: Haskell2010

View File

@ -49,6 +49,7 @@ dependencies:
- cmdargs >=0.10
- containers
- csv
- cassava
- data-default >=0.5
- Decimal
- deepseq

View File

@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: 3be7e8745a826dbfc9d0007b9b37c3962486573614267365e6dafb8f7079ece6
-- hash: fc9d50bfd8e455c344f6ba60fd05358537cb2f3a6bc968eca7e554364f4cc1fe
name: hledger
version: 1.10.99
@ -118,7 +118,6 @@ library
, base >=4.8 && <4.12
, base-compat-batteries >=0.10.1 && <0.11
, bytestring
, cassava
, cmdargs >=0.10
, containers
, csv
@ -172,7 +171,6 @@ executable hledger
, base >=4.8 && <4.12
, base-compat-batteries >=0.10.1 && <0.11
, bytestring
, cassava
, cmdargs >=0.10
, containers
, csv
@ -228,7 +226,6 @@ test-suite test
, base >=4.8 && <4.12
, base-compat-batteries >=0.10.1 && <0.11
, bytestring
, cassava
, cmdargs >=0.10
, containers
, csv
@ -283,7 +280,6 @@ benchmark bench
, base >=4.8 && <4.12
, base-compat-batteries >=0.10.1 && <0.11
, bytestring
, cassava
, cmdargs >=0.10
, containers
, criterion

View File

@ -86,7 +86,6 @@ dependencies:
- cmdargs >=0.10
- containers
- csv
- cassava
- data-default >=0.5
- Decimal
- directory