-- | A single module to centralise all our dependencies on
-- the hledger codebase.

module LedgerT (
  Day(..),
  RawLedger(..),
  Entry(..),
  MixedAmount(..),
  Amount(..),
  RawTransaction(..),
  Commodity(..),
  HistoricalPrice(..),

  parseRawLedger,
  rawLedgerEmpty,

  accountNameComponents,
  amounts,
  dollar,
  showAmount,
  showAmount',
) where

import Text.ParserCombinators.Parsec(runParser)
import Control.Monad.Error

import Ledger

parseRawLedger :: FilePath -> String -> IO (Either String RawLedger)
parseRawLedger inname intxt = runErrorT $ do
  case runParser ledgerFile emptyCtx inname intxt of
    Right m  -> m `ap` (return rawLedgerEmpty)
    Left err -> throwError $ show err

