/usr/share/doc/libghc-hledger-lib-doc/html/hledger-lib.txt is in libghc-hledger-lib-doc 0.23.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Core data types, parsers and utilities for the hledger accounting tool.
--
-- hledger is a library and set of user tools for working with financial
-- data (or anything that can be tracked in a double-entry accounting
-- ledger.) It is a haskell port and friendly fork of John Wiegley's
-- Ledger. hledger provides command-line, curses and web interfaces, and
-- aims to be a reliable, practical tool for daily use.
@package hledger-lib
@version 0.23.3
-- | UTF-8 aware string IO functions that will work across multiple
-- platforms and GHC versions. Includes code from Text.Pandoc.UTF8 ((C)
-- 2010 John MacFarlane).
--
-- Example usage:
--
-- import Prelude hiding
-- (readFile,writeFile,appendFile,getContents,putStr,putStrLn) import
-- UTF8IOCompat
-- (readFile,writeFile,appendFile,getContents,putStr,putStrLn) import
-- UTF8IOCompat
-- (SystemString,fromSystemString,toSystemString,error',userError')
--
-- 2013<i>4</i>10 update: we now trust that current GHC versions &
-- platforms do the right thing, so this file is a no-op and on its way
-- to being removed. Not carefully tested.
module Hledger.Utils.UTF8IOCompat
-- | The <a>readFile</a> function reads a file and returns the contents of
-- the file as a string. The file is read lazily, on demand, as with
-- <a>getContents</a>.
readFile :: FilePath -> IO String
-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
-- string <tt>str</tt>, to the file <tt>file</tt>.
writeFile :: FilePath -> String -> IO ()
-- | The computation <a>appendFile</a> <tt>file str</tt> function appends
-- the string <tt>str</tt>, to the file <tt>file</tt>.
--
-- Note that <a>writeFile</a> and <a>appendFile</a> write a literal
-- string to a file. To write a value of any printable type, as with
-- <a>print</a>, use the <a>show</a> function to convert the value to a
-- string first.
--
-- <pre>
-- main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])
-- </pre>
appendFile :: FilePath -> String -> IO ()
-- | The <a>getContents</a> operation returns all user input as a single
-- string, which is read lazily as it is needed (same as
-- <a>hGetContents</a> <a>stdin</a>).
getContents :: IO String
-- | Computation <a>hGetContents</a> <tt>hdl</tt> returns the list of
-- characters corresponding to the unread portion of the channel or file
-- managed by <tt>hdl</tt>, which is put into an intermediate state,
-- <i>semi-closed</i>. In this state, <tt>hdl</tt> is effectively closed,
-- but items are read from <tt>hdl</tt> on demand and accumulated in a
-- special list returned by <a>hGetContents</a> <tt>hdl</tt>.
--
-- Any operation that fails because a handle is closed, also fails if a
-- handle is semi-closed. The only exception is <tt>hClose</tt>. A
-- semi-closed handle becomes closed:
--
-- <ul>
-- <li>if <tt>hClose</tt> is applied to it;</li>
-- <li>if an I/O error occurs when reading an item from the handle;</li>
-- <li>or once the entire contents of the handle has been read.</li>
-- </ul>
--
-- Once a semi-closed handle becomes closed, the contents of the
-- associated list becomes fixed. The contents of this final list is only
-- partially specified: it will contain at least all the items of the
-- stream that were evaluated prior to the handle becoming closed.
--
-- Any I/O errors encountered while a handle is semi-closed are simply
-- discarded.
--
-- This operation may fail with:
--
-- <ul>
-- <li><a>isEOFError</a> if the end of file has been reached.</li>
-- </ul>
hGetContents :: Handle -> IO String
-- | Write a string to the standard output device (same as <a>hPutStr</a>
-- <a>stdout</a>).
putStr :: String -> IO ()
-- | The same as <a>putStr</a>, but adds a newline character.
putStrLn :: String -> IO ()
-- | Computation <a>hPutStr</a> <tt>hdl s</tt> writes the string <tt>s</tt>
-- to the file or channel managed by <tt>hdl</tt>.
--
-- This operation may fail with:
--
-- <ul>
-- <li><a>isFullError</a> if the device is full; or</li>
-- <li><a>isPermissionError</a> if another system resource limit would be
-- exceeded.</li>
-- </ul>
hPutStr :: Handle -> String -> IO ()
-- | The same as <a>hPutStr</a>, but adds a newline character.
hPutStrLn :: Handle -> String -> IO ()
-- | A string received from or being passed to the operating system, such
-- as a file path, command-line argument, or environment variable name or
-- value. With GHC versions before 7.2 on some platforms (posix) these
-- are typically encoded. When converting, we assume the encoding is
-- UTF-8 (cf
-- <a>http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html#UTF8</a>).
type SystemString = String
-- | Convert a system string to an ordinary string, decoding from UTF-8 if
-- it appears to be UTF8-encoded and GHC version is less than 7.2.
fromSystemString :: SystemString -> String
-- | Convert a unicode string to a system string, encoding with UTF-8 if we
-- are on a posix platform with GHC < 7.2.
toSystemString :: String -> SystemString
-- | A SystemString-aware version of error.
error' :: String -> a
-- | A SystemString-aware version of userError.
userError' :: String -> IOError
-- | Most data types are defined here to avoid import cycles. Here is an
-- overview of the hledger data model:
--
-- <pre>
-- Journal -- a journal is read from one or more data files. It contains..
-- [Transaction] -- journal transactions (aka entries), which have date, status, code, description and..
-- [Posting] -- multiple account postings, which have account name and amount
-- [HistoricalPrice] -- historical commodity prices
--
-- Ledger -- a ledger is derived from a journal, by applying a filter specification and doing some further processing. It contains..
-- Journal -- a filtered copy of the original journal, containing only the transactions and postings we are interested in
-- [Account] -- all accounts, in tree order beginning with a "root" account", with their balances and sub/parent accounts
-- </pre>
--
-- For more detailed documentation on each type, see the corresponding
-- modules.
module Hledger.Data.Types
type SmartDate = (String, String, String)
data WhichDate
PrimaryDate :: WhichDate
SecondaryDate :: WhichDate
data DateSpan
DateSpan :: (Maybe Day) -> (Maybe Day) -> DateSpan
data Interval
NoInterval :: Interval
Days :: Int -> Interval
Weeks :: Int -> Interval
Months :: Int -> Interval
Quarters :: Int -> Interval
Years :: Int -> Interval
DayOfMonth :: Int -> Interval
DayOfWeek :: Int -> Interval
type AccountName = String
data Side
L :: Side
R :: Side
type Commodity = String
type Quantity = Double
-- | An amount's price (none, per unit, or total) in another commodity.
-- Note the price should be a positive number, although this is not
-- enforced.
data Price
NoPrice :: Price
UnitPrice :: Amount -> Price
TotalPrice :: Amount -> Price
-- | Display style for an amount.
data AmountStyle
AmountStyle :: Side -> Bool -> Int -> Char -> Char -> [Int] -> AmountStyle
-- | does the symbol appear on the left or the right ?
ascommodityside :: AmountStyle -> Side
-- | space between symbol and quantity ?
ascommodityspaced :: AmountStyle -> Bool
-- | number of digits displayed after the decimal point
asprecision :: AmountStyle -> Int
-- | character used as decimal point
asdecimalpoint :: AmountStyle -> Char
-- | character used for separating digit groups (eg thousands)
asseparator :: AmountStyle -> Char
-- | positions of digit group separators, counting leftward from decimal
-- point
asseparatorpositions :: AmountStyle -> [Int]
data Amount
Amount :: Commodity -> Quantity -> Price -> AmountStyle -> Amount
acommodity :: Amount -> Commodity
aquantity :: Amount -> Quantity
-- | the (fixed) price for this amount, if any
aprice :: Amount -> Price
astyle :: Amount -> AmountStyle
newtype MixedAmount
Mixed :: [Amount] -> MixedAmount
data PostingType
RegularPosting :: PostingType
VirtualPosting :: PostingType
BalancedVirtualPosting :: PostingType
type Tag = (String, String)
data Posting
Posting :: Maybe Day -> Maybe Day -> Bool -> AccountName -> MixedAmount -> String -> PostingType -> [Tag] -> Maybe MixedAmount -> Maybe Transaction -> Posting
-- | this posting's date, if different from the transaction's
pdate :: Posting -> Maybe Day
-- | this posting's secondary date, if different from the transaction's
pdate2 :: Posting -> Maybe Day
pstatus :: Posting -> Bool
paccount :: Posting -> AccountName
pamount :: Posting -> MixedAmount
-- | this posting's comment lines, as a single non-indented multi-line
-- string
pcomment :: Posting -> String
ptype :: Posting -> PostingType
-- | tag names and values, extracted from the comment
ptags :: Posting -> [Tag]
-- | optional: the expected balance in the account after this posting
pbalanceassertion :: Posting -> Maybe MixedAmount
-- | this posting's parent transaction (co-recursive types). Tying this
-- knot gets tedious, Maybe makes it easier/optional.
ptransaction :: Posting -> Maybe Transaction
data Transaction
Transaction :: Day -> Maybe Day -> Bool -> String -> String -> String -> [Tag] -> [Posting] -> String -> Transaction
tdate :: Transaction -> Day
tdate2 :: Transaction -> Maybe Day
tstatus :: Transaction -> Bool
tcode :: Transaction -> String
tdescription :: Transaction -> String
-- | this transaction's comment lines, as a single non-indented multi-line
-- string
tcomment :: Transaction -> String
-- | tag names and values, extracted from the comment
ttags :: Transaction -> [Tag]
-- | this transaction's postings
tpostings :: Transaction -> [Posting]
-- | any comment lines immediately preceding this transaction
tpreceding_comment_lines :: Transaction -> String
data ModifierTransaction
ModifierTransaction :: String -> [Posting] -> ModifierTransaction
mtvalueexpr :: ModifierTransaction -> String
mtpostings :: ModifierTransaction -> [Posting]
data PeriodicTransaction
PeriodicTransaction :: String -> [Posting] -> PeriodicTransaction
ptperiodicexpr :: PeriodicTransaction -> String
ptpostings :: PeriodicTransaction -> [Posting]
data TimeLogCode
SetBalance :: TimeLogCode
SetRequiredHours :: TimeLogCode
In :: TimeLogCode
Out :: TimeLogCode
FinalOut :: TimeLogCode
data TimeLogEntry
TimeLogEntry :: TimeLogCode -> LocalTime -> String -> TimeLogEntry
tlcode :: TimeLogEntry -> TimeLogCode
tldatetime :: TimeLogEntry -> LocalTime
tlcomment :: TimeLogEntry -> String
data HistoricalPrice
HistoricalPrice :: Day -> Commodity -> Amount -> HistoricalPrice
hdate :: HistoricalPrice -> Day
hcommodity :: HistoricalPrice -> Commodity
hamount :: HistoricalPrice -> Amount
type Year = Integer
-- | A journal <a>context</a> is some data which can change in the course
-- of parsing a journal. An example is the default year, which changes
-- when a Y directive is encountered. At the end of parsing, the final
-- context is saved for later use by eg the add command.
data JournalContext
Ctx :: !(Maybe Year) -> !(Maybe (Commodity, AmountStyle)) -> ![AccountName] -> ![(AccountName, AccountName)] -> JournalContext
-- | the default year most recently specified with Y
ctxYear :: JournalContext -> !(Maybe Year)
-- | the default commodity and amount style most recently specified with D
ctxCommodityAndStyle :: JournalContext -> !(Maybe (Commodity, AmountStyle))
-- | the current stack of parent accounts/account name components specified
-- with <a>account</a> directive(s). Concatenated, these are the account
-- prefix prepended to parsed account names.
ctxAccount :: JournalContext -> ![AccountName]
-- | the current list of account name aliases in effect
ctxAliases :: JournalContext -> ![(AccountName, AccountName)]
data Journal
Journal :: [ModifierTransaction] -> [PeriodicTransaction] -> [Transaction] -> [TimeLogEntry] -> [HistoricalPrice] -> String -> JournalContext -> [(FilePath, String)] -> ClockTime -> Map Commodity AmountStyle -> Journal
jmodifiertxns :: Journal -> [ModifierTransaction]
jperiodictxns :: Journal -> [PeriodicTransaction]
jtxns :: Journal -> [Transaction]
open_timelog_entries :: Journal -> [TimeLogEntry]
historical_prices :: Journal -> [HistoricalPrice]
-- | any trailing comments from the journal file
final_comment_lines :: Journal -> String
-- | the context (parse state) at the end of parsing
jContext :: Journal -> JournalContext
-- | the file path and raw text of the main and any included journal files.
-- The main file is first followed by any included files in the order
-- encountered (XXX reversed, cf journalAddFile).
files :: Journal -> [(FilePath, String)]
-- | when this journal was last read from its file(s)
filereadtime :: Journal -> ClockTime
-- | how to display amounts in each commodity
jcommoditystyles :: Journal -> Map Commodity AmountStyle
-- | A JournalUpdate is some transformation of a Journal. It can do I/O or
-- raise an error.
type JournalUpdate = ErrorT String IO (Journal -> Journal)
-- | The id of a data format understood by hledger, eg <tt>journal</tt> or
-- <tt>csv</tt>.
type StorageFormat = String
-- | A hledger journal reader is a triple of format name, format-detecting
-- predicate, and a parser to Journal.
data Reader
Reader :: StorageFormat -> (FilePath -> String -> Bool) -> (Maybe FilePath -> FilePath -> String -> ErrorT String IO Journal) -> Reader
rFormat :: Reader -> StorageFormat
rDetector :: Reader -> FilePath -> String -> Bool
rParser :: Reader -> Maybe FilePath -> FilePath -> String -> ErrorT String IO Journal
data HledgerFormatField
AccountField :: HledgerFormatField
DefaultDateField :: HledgerFormatField
DescriptionField :: HledgerFormatField
TotalField :: HledgerFormatField
DepthSpacerField :: HledgerFormatField
FieldNo :: Int -> HledgerFormatField
data OutputFormat
FormatLiteral :: String -> OutputFormat
FormatField :: Bool -> (Maybe Int) -> (Maybe Int) -> HledgerFormatField -> OutputFormat
-- | An account, with name, balances and links to parent/subaccounts which
-- let you walk up or down the account tree.
data Account
Account :: AccountName -> MixedAmount -> [Account] -> Int -> MixedAmount -> Maybe Account -> Bool -> Account
-- | this account's full name
aname :: Account -> AccountName
-- | this account's balance, excluding subaccounts
aebalance :: Account -> MixedAmount
-- | sub-accounts
asubs :: Account -> [Account]
-- | number of postings to this account derived from the above:
anumpostings :: Account -> Int
-- | this account's balance, including subaccounts
aibalance :: Account -> MixedAmount
-- | parent account
aparent :: Account -> Maybe Account
-- | used in the accounts report to label elidable parents
aboring :: Account -> Bool
-- | A Ledger has the journal it derives from, and the accounts derived
-- from that. Accounts are accessible both list-wise and tree-wise, since
-- each one knows its parent and subs; the first account is the root of
-- the tree and always exists.
data Ledger
Ledger :: Journal -> [Account] -> Ledger
ljournal :: Ledger -> Journal
laccounts :: Ledger -> [Account]
instance Typeable DateSpan
instance Typeable Interval
instance Typeable Side
instance Typeable AmountStyle
instance Typeable Amount
instance Typeable Price
instance Typeable MixedAmount
instance Typeable PostingType
instance Typeable Transaction
instance Typeable Posting
instance Typeable ModifierTransaction
instance Typeable PeriodicTransaction
instance Typeable TimeLogCode
instance Typeable TimeLogEntry
instance Typeable HistoricalPrice
instance Typeable JournalContext
instance Typeable Journal
instance Typeable ClockTime
instance Data ClockTime
instance Eq WhichDate
instance Show WhichDate
instance Eq DateSpan
instance Ord DateSpan
instance Data DateSpan
instance Eq Interval
instance Show Interval
instance Ord Interval
instance Data Interval
instance Eq Side
instance Show Side
instance Read Side
instance Ord Side
instance Data Side
instance Eq AmountStyle
instance Ord AmountStyle
instance Read AmountStyle
instance Show AmountStyle
instance Data AmountStyle
instance Eq Amount
instance Ord Amount
instance Data Amount
instance Eq Price
instance Ord Price
instance Data Price
instance Eq MixedAmount
instance Ord MixedAmount
instance Data MixedAmount
instance Eq PostingType
instance Show PostingType
instance Data PostingType
instance Eq Transaction
instance Data Transaction
instance Data Posting
instance Eq ModifierTransaction
instance Data ModifierTransaction
instance Eq PeriodicTransaction
instance Data PeriodicTransaction
instance Eq TimeLogCode
instance Ord TimeLogCode
instance Data TimeLogCode
instance Eq TimeLogEntry
instance Ord TimeLogEntry
instance Data TimeLogEntry
instance Eq HistoricalPrice
instance Data HistoricalPrice
instance Read JournalContext
instance Show JournalContext
instance Eq JournalContext
instance Data JournalContext
instance Eq Journal
instance Data Journal
instance Show HledgerFormatField
instance Eq HledgerFormatField
instance Show OutputFormat
instance Eq OutputFormat
instance Show Reader
instance Eq Posting
module Hledger.Data.OutputFormat
parseStringFormat :: String -> Either String [OutputFormat]
formatsp :: GenParser Char st [OutputFormat]
formatValue :: Bool -> Maybe Int -> Maybe Int -> String -> String
data OutputFormat
FormatLiteral :: String -> OutputFormat
FormatField :: Bool -> (Maybe Int) -> (Maybe Int) -> HledgerFormatField -> OutputFormat
data HledgerFormatField
AccountField :: HledgerFormatField
DefaultDateField :: HledgerFormatField
DescriptionField :: HledgerFormatField
TotalField :: HledgerFormatField
DepthSpacerField :: HledgerFormatField
FieldNo :: Int -> HledgerFormatField
tests :: Test
-- | Standard imports and utilities which are useful everywhere, or needed
-- low in the module hierarchy. This is the bottom of hledger's module
-- graph.
module Hledger.Utils
lowercase :: [Char] -> [Char]
uppercase :: [Char] -> [Char]
strip :: [Char] -> String
lstrip :: String -> String
rstrip :: [Char] -> [Char]
stripbrackets :: String -> String
elideLeft :: Int -> [Char] -> [Char]
elideRight :: Int -> [Char] -> [Char]
underline :: String -> String
-- | Wrap a string in double quotes, and -prefix any embedded single
-- quotes, if it contains whitespace and is not already single- or
-- double-quoted.
quoteIfSpaced :: String -> String
-- | Double-quote this string if it contains whitespace, single quotes or
-- double-quotes, escaping the quotes as needed.
quoteIfNeeded :: [Char] -> [Char]
-- | Single-quote this string if it contains whitespace or double-quotes.
-- No good for strings containing single quotes.
singleQuoteIfNeeded :: [Char] -> [Char]
quotechars :: [Char]
whitespacechars :: [Char]
escapeDoubleQuotes :: String -> String
escapeSingleQuotes :: String -> String
escapeQuotes :: String -> String
-- | Quote-aware version of words - don't split on spaces which are inside
-- quotes. NB correctly handles <a>a'b</a> but not <a>''a''</a>. Can
-- raise an error if parsing fails.
words' :: String -> [String]
-- | Quote-aware version of unwords - single-quote strings which contain
-- whitespace
unwords' :: [String] -> String
-- | Strip one matching pair of single or double quotes on the ends of a
-- string.
stripquotes :: String -> String
isSingleQuoted :: [Char] -> Bool
isDoubleQuoted :: [Char] -> Bool
unbracket :: String -> String
-- | Join multi-line strings as side-by-side rectangular strings of the
-- same height, top-padded.
concatTopPadded :: [String] -> String
-- | Join multi-line strings as side-by-side rectangular strings of the
-- same height, bottom-padded.
concatBottomPadded :: [String] -> String
-- | Compose strings vertically and right-aligned.
vConcatRightAligned :: [String] -> String
-- | Convert a multi-line string to a rectangular string top-padded to the
-- specified height.
padtop :: Int -> String -> String
-- | Convert a multi-line string to a rectangular string bottom-padded to
-- the specified height.
padbottom :: Int -> String -> String
-- | Convert a multi-line string to a rectangular string left-padded to the
-- specified width.
padleft :: Int -> String -> String
-- | Convert a multi-line string to a rectangular string right-padded to
-- the specified width.
padright :: Int -> String -> String
-- | Clip a multi-line string to the specified width and height from the
-- top left.
cliptopleft :: Int -> Int -> String -> String
-- | Clip and pad a multi-line string to fill the specified width and
-- height.
fitto :: Int -> Int -> String -> String
first3 :: (t, t1, t2) -> t
second3 :: (t, t1, t2) -> t1
third3 :: (t, t1, t2) -> t2
first4 :: (t, t1, t2, t3) -> t
second4 :: (t, t1, t2, t3) -> t1
third4 :: (t, t1, t2, t3) -> t2
fourth4 :: (t, t1, t2, t3) -> t3
first5 :: (t, t1, t2, t3, t4) -> t
second5 :: (t, t1, t2, t3, t4) -> t1
third5 :: (t, t1, t2, t3, t4) -> t2
fourth5 :: (t, t1, t2, t3, t4) -> t3
fifth5 :: (t, t1, t2, t3, t4) -> t4
difforzero :: (Num a, Ord a) => a -> a -> a
regexMatch :: String -> String -> Maybe (RegexResult, MatchList)
regexMatchCI :: String -> String -> Maybe (RegexResult, MatchList)
regexMatches :: String -> String -> Bool
regexMatchesCI :: String -> String -> Bool
containsRegex :: String -> String -> Bool
regexReplace :: String -> String -> String -> String
regexReplaceCI :: String -> String -> String -> String
regexReplaceBy :: String -> (String -> String) -> String -> String
regexToCaseInsensitive :: String -> String
regexSplit :: String -> String -> [String]
regexMatchesRegexCompat :: String -> String -> Bool
regexMatchesCIRegexCompat :: String -> String -> Bool
splitAtElement :: Eq a => a -> [a] -> [[a]]
root :: Tree a -> a
subs :: Tree a -> Forest a
branches :: Tree a -> Forest a
-- | List just the leaf nodes of a tree
leaves :: Tree a -> [a]
-- | get the sub-tree rooted at the first (left-most, depth-first)
-- occurrence of the specified node value
subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a)
-- | get the sub-tree for the specified node value in the first tree in
-- forest in which it occurs.
subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a)
-- | remove all nodes past a certain depth
treeprune :: Int -> Tree a -> Tree a
-- | apply f to all tree nodes
treemap :: (a -> b) -> Tree a -> Tree b
-- | remove all subtrees whose nodes do not fulfill predicate
treefilter :: (a -> Bool) -> Tree a -> Tree a
-- | is predicate true in any node of tree ?
treeany :: (a -> Bool) -> Tree a -> Bool
-- | show a compact ascii representation of a tree
showtree :: Show a => Tree a -> String
-- | show a compact ascii representation of a forest
showforest :: Show a => Forest a -> String
-- | An efficient-to-build tree suggested by Cale Gibbard, probably better
-- than accountNameTreeFrom.
newtype FastTree a
T :: (Map a (FastTree a)) -> FastTree a
emptyTree :: FastTree a
mergeTrees :: Ord a => FastTree a -> FastTree a -> FastTree a
treeFromPath :: [a] -> FastTree a
treeFromPaths :: Ord a => [[a]] -> FastTree a
-- | Trace (print on stdout at runtime) a showable value. (for easily
-- tracing in the middle of a complex expression)
strace :: Show a => a -> a
-- | Labelled trace - like strace, with a label prepended.
ltrace :: Show a => String -> a -> a
-- | Monadic trace - like strace, but works as a standalone line in a
-- monad.
mtrace :: (Monad m, Show a) => a -> m a
-- | Custom trace - like strace, with a custom show function.
traceWith :: (a -> String) -> a -> a
-- | Parsec trace - show the current parsec position and next input, and
-- the provided label if it's non-null.
ptrace :: String -> GenParser Char st ()
-- | Global debug level, which controls the verbosity of debug output on
-- the console. The default is 0 meaning no debug output. The
-- <tt>--debug</tt> command line flag sets it to 1, or <tt>--debug=N</tt>
-- sets it to a higher value (note: not <tt>--debug N</tt> for some
-- reason). This uses unsafePerformIO and can be accessed from anywhere
-- and before normal command-line processing. After command-line
-- processing, it is also available as the <tt>debug_</tt> field of
-- <a>CliOpts</a>.
debugLevel :: Int
-- | Print a message and a showable value to the console if the global
-- debug level is non-zero. Uses unsafePerformIO.
dbg :: Show a => String -> a -> a
dbg0 :: Show a => String -> a -> a
dbg1 :: Show a => String -> a -> a
dbg2 :: Show a => String -> a -> a
-- | Print a message and a showable value to the console if the global
-- debug level is at or above the specified level. Uses unsafePerformIO.
dbgAt :: Show a => Int -> String -> a -> a
dbgAtM :: Show a => Int -> String -> a -> IO ()
-- | Print a showable value to the console, with a message, if the debug
-- level is at or above the specified level (uses unsafePerformIO).
-- Values are displayed with show, all on one line, which is hard to
-- read.
dbgshow :: Show a => Int -> String -> a -> a
-- | Print a showable value to the console, with a message, if the debug
-- level is at or above the specified level (uses unsafePerformIO).
-- Values are displayed with ppShow, each field/constructor on its own
-- line.
dbgppshow :: Show a => Int -> String -> a -> a
-- | Like dbg, then exit the program. Uses unsafePerformIO.
dbgExit :: Show a => String -> a -> a
-- | Print a message and parsec debug info (parse position and next input)
-- to the console when the debug level is at or above this level. Uses
-- unsafePerformIO. pdbgAt :: GenParser m => Float -> String ->
-- m ()
pdbg :: Int -> String -> ParsecT [Char] st Identity ()
-- | Backtracking choice, use this when alternatives share a prefix.
-- Consumes no input if all choices fail.
choice' :: [GenParser tok st a] -> GenParser tok st a
parsewith :: Parser a -> String -> Either ParseError a
parseWithCtx :: b -> GenParser Char b a -> String -> Either ParseError a
fromparse :: Either ParseError a -> a
parseerror :: ParseError -> a
showParseError :: ParseError -> String
showDateParseError :: ParseError -> String
nonspace :: GenParser Char st Char
spacenonewline :: GenParser Char st Char
restofline :: GenParser Char st String
eolof :: GenParser Char st ()
getCurrentLocalTime :: IO LocalTime
-- | Get a Test's label, or the empty string.
testName :: Test -> String
-- | Flatten a Test containing TestLists into a list of single tests.
flattenTests :: Test -> [Test]
-- | Filter TestLists in a Test, recursively, preserving the structure.
filterTests :: (Test -> Bool) -> Test -> Test
-- | Simple way to assert something is some expected value, with no label.
is :: (Eq a, Show a) => a -> a -> Assertion
-- | Assert a parse result is successful, printing the parse error on
-- failure.
assertParse :: (Either ParseError a) -> Assertion
-- | Assert a parse result is successful, printing the parse error on
-- failure.
assertParseFailure :: (Either ParseError a) -> Assertion
-- | Assert a parse result is some expected value, printing the parse error
-- on failure.
assertParseEqual :: (Show a, Eq a) => (Either ParseError a) -> a -> Assertion
printParseError :: Show a => a -> IO ()
isLeft :: Either a b -> Bool
isRight :: Either a b -> Bool
-- | Apply a function the specified number of times. Possibly uses O(n)
-- stack ?
applyN :: Int -> (a -> a) -> a -> a
-- | Convert a possibly relative, possibly tilde-containing file path to an
-- absolute one, given the current directory. ~username is not supported.
-- Leave <a>-</a> unchanged.
expandPath :: MonadIO m => FilePath -> FilePath -> m FilePath
firstJust :: Eq a => [Maybe a] -> Maybe a
-- | Read a file in universal newline mode, handling whatever newline
-- convention it may contain.
readFile' :: FilePath -> IO String
-- | The <a>trace</a> function outputs the trace message given as its first
-- argument, before returning the second argument as its result.
--
-- For example, this returns the value of <tt>f x</tt> but first outputs
-- the message.
--
-- <pre>
-- trace ("calling f with x = " ++ show x) (f x)
-- </pre>
--
-- The <a>trace</a> function should <i>only</i> be used for debugging, or
-- for monitoring execution. The function is not referentially
-- transparent: its type indicates that it is a pure function but it has
-- the side effect of outputting the trace message.
trace :: String -> a -> a
-- | A string received from or being passed to the operating system, such
-- as a file path, command-line argument, or environment variable name or
-- value. With GHC versions before 7.2 on some platforms (posix) these
-- are typically encoded. When converting, we assume the encoding is
-- UTF-8 (cf
-- <a>http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html#UTF8</a>).
type SystemString = String
-- | Convert a system string to an ordinary string, decoding from UTF-8 if
-- it appears to be UTF8-encoded and GHC version is less than 7.2.
fromSystemString :: SystemString -> String
-- | Convert a unicode string to a system string, encoding with UTF-8 if we
-- are on a posix platform with GHC < 7.2.
toSystemString :: String -> SystemString
-- | A SystemString-aware version of error.
error' :: String -> a
-- | A SystemString-aware version of userError.
userError' :: String -> IOError
-- | Convert a generic value into a pretty <a>String</a>, if possible.
ppShow :: Show a => a -> String
instance Show a => Show (FastTree a)
instance Eq a => Eq (FastTree a)
instance Ord a => Ord (FastTree a)
-- | <a>AccountName</a>s are strings like <tt>assets:cash:petty</tt>, with
-- multiple components separated by <tt>:</tt>. From a set of these we
-- derive the account hierarchy.
module Hledger.Data.AccountName
acctsepchar :: Char
accountNameComponents :: AccountName -> [String]
accountNameFromComponents :: [String] -> AccountName
accountLeafName :: AccountName -> String
accountNameLevel :: AccountName -> Int
accountNameDrop :: Int -> AccountName -> AccountName
-- | <ul>
-- <li><i><a>a:b:c</a>,<a>d:e</a></i> ->
-- [<a>a</a>,<a>a:b</a>,<a>a:b:c</a>,<a>d</a>,<a>d:e</a>]</li>
-- </ul>
expandAccountNames :: [AccountName] -> [AccountName]
-- | <a>a:b:c</a> -> [<a>a</a>,<a>a:b</a>,<a>a:b:c</a>]
expandAccountName :: AccountName -> [AccountName]
-- | <ul>
-- <li><i><a>a:b:c</a>,<a>d:e</a></i> -> [<a>a</a>,<a>d</a>]</li>
-- </ul>
topAccountNames :: [AccountName] -> [AccountName]
parentAccountName :: AccountName -> AccountName
parentAccountNames :: AccountName -> [AccountName]
isAccountNamePrefixOf :: AccountName -> AccountName -> Bool
isSubAccountNameOf :: AccountName -> AccountName -> Bool
-- | From a list of account names, select those which are direct
-- subaccounts of the given account name.
subAccountNamesFrom :: [AccountName] -> AccountName -> [AccountName]
-- | Convert a list of account names to a tree.
accountNameTreeFrom :: [AccountName] -> Tree AccountName
nullaccountnametree :: Tree [Char]
-- | Elide an account name to fit in the specified width. From the ledger
-- 2.6 news:
--
-- <pre>
-- What Ledger now does is that if an account name is too long, it will
-- start abbreviating the first parts of the account name down to two
-- letters in length. If this results in a string that is still too
-- long, the front will be elided -- not the end. For example:
--
-- Expenses:Cash ; OK, not too long
-- Ex:Wednesday:Cash ; <a>Expenses</a> was abbreviated to fit
-- Ex:We:Afternoon:Cash ; <a>Expenses</a> and <a>Wednesday</a> abbreviated
-- ; Expenses:Wednesday:Afternoon:Lunch:Snack:Candy:Chocolate:Cash
-- ..:Af:Lu:Sn:Ca:Ch:Cash ; Abbreviated and elided!
-- </pre>
elideAccountName :: Int -> AccountName -> AccountName
clipAccountName :: Int -> AccountName -> AccountName
-- | Convert an account name to a regular expression matching it and its
-- subaccounts.
accountNameToAccountRegex :: String -> String
-- | Convert an account name to a regular expression matching it but not
-- its subaccounts.
accountNameToAccountOnlyRegex :: String -> String
-- | Convert an exact account-matching regular expression to a plain
-- account name.
accountRegexToAccountName :: String -> String
-- | Does this string look like an exact account-matching regular
-- expression ?
isAccountRegex :: String -> Bool
tests_Hledger_Data_AccountName :: Test
-- | A <a>Commodity</a> is a symbol representing a currency or some other
-- kind of thing we are tracking, and some display preferences that tell
-- how to display <a>Amount</a>s of the commodity - is the symbol on the
-- left or right, are thousands separated by comma, significant decimal
-- places and so on.
module Hledger.Data.Commodity
nonsimplecommoditychars :: String
quoteCommoditySymbolIfNeeded :: [Char] -> [Char]
commodity :: [Char]
commoditysymbols :: [([Char], [Char])]
-- | Look up one of the sample commodities' symbol by name.
comm :: String -> Commodity
-- | Find the conversion rate between two commodities. Currently returns 1.
conversionRate :: Commodity -> Commodity -> Double
tests_Hledger_Data_Commodity :: Test
-- | A simple <a>Amount</a> is some quantity of money, shares, or anything
-- else. It has a (possibly null) <a>Commodity</a> and a numeric
-- quantity:
--
-- <pre>
-- $1
-- £-50 EUR 3.44
-- GOOG 500
-- 1.5h
-- 90 apples
-- 0
-- </pre>
--
-- It may also have an assigned <a>Price</a>, representing this amount's
-- per-unit or total cost in a different commodity. If present, this is
-- rendered like so:
--
-- <pre>
-- EUR 2 @ $1.50 (unit price)
-- EUR 2 @@ $3 (total price)
-- </pre>
--
-- A <a>MixedAmount</a> is zero or more simple amounts, so can represent
-- multiple commodities; this is the type most often used:
--
-- <pre>
-- 0
-- $50 + EUR 3
-- 16h + $13.55 + AAPL 500 + 6 oranges
-- </pre>
--
-- When a mixed amount has been "normalised", it has no more than one
-- amount in each commodity and no zero amounts; or it has just a single
-- zero amount and no others.
--
-- Limited arithmetic with simple and mixed amounts is supported, best
-- used with similar amounts since it mostly ignores assigned prices and
-- commodity exchange rates.
module Hledger.Data.Amount
-- | The empty simple amount.
amount :: Amount
-- | The empty simple amount.
nullamt :: Amount
-- | A temporary value for parsed transactions which had no amount
-- specified.
missingamt :: Amount
num :: Quantity -> Amount
usd :: Quantity -> Amount
eur :: Quantity -> Amount
gbp :: Quantity -> Amount
hrs :: Quantity -> Amount
-- | Set an amount's unit price.
at :: Amount -> Amount -> Amount
-- | Set an amount's total price.
(@@) :: Amount -> Amount -> Amount
-- | Convert an amount to the specified commodity, ignoring and discarding
-- any assigned prices and assuming an exchange rate of 1.
amountWithCommodity :: Commodity -> Amount -> Amount
-- | Convert an amount to the commodity of its assigned price, if any.
-- Notes:
--
-- <ul>
-- <li>price amounts must be MixedAmounts with exactly one component
-- Amount (or there will be a runtime error)</li>
-- <li>price amounts should be positive, though this is not currently
-- enforced</li>
-- </ul>
costOfAmount :: Amount -> Amount
-- | Divide an amount's quantity by a constant.
divideAmount :: Amount -> Double -> Amount
-- | A more complete amount adding operation.
sumAmounts :: [Amount] -> MixedAmount
amountstyle :: AmountStyle
-- | Get the string representation of an amount, based on its commodity's
-- display settings. String representations equivalent to zero are
-- converted to just "0".
showAmount :: Amount -> String
-- | Get a string representation of an amount for debugging, appropriate to
-- the current debug level. 9 shows maximum detail.
showAmountDebug :: Amount -> String
-- | Get the string representation of an amount, without any @ price.
showAmountWithoutPrice :: Amount -> String
-- | For rendering: a special precision value which means show all
-- available digits.
maxprecision :: Int
-- | For rendering: a special precision value which forces display of a
-- decimal point.
maxprecisionwithpoint :: Int
-- | Set an amount's display precision.
setAmountPrecision :: Int -> Amount -> Amount
-- | Set an amount's display precision, flipped.
withPrecision :: Amount -> Int -> Amount
-- | Canonicalise an amount's display style using the provided commodity
-- style map.
canonicaliseAmount :: Map Commodity AmountStyle -> Amount -> Amount
-- | Given a list of amounts in parse order, build a map from commodities
-- to canonical display styles for amounts in that commodity.
canonicalStyles :: [Amount] -> Map Commodity AmountStyle
-- | The empty mixed amount.
nullmixedamt :: MixedAmount
missingmixedamt :: MixedAmount
mixed :: Amount -> MixedAmount
-- | Get a mixed amount's component amounts.
amounts :: MixedAmount -> [Amount]
-- | Simplify a mixed amount's component amounts: combine amounts with the
-- same commodity, using the first amount's price for subsequent amounts
-- in each commodity (ie, this function alters the amount and is best
-- used as a rendering helper.). Also remove any zero amounts and replace
-- an empty amount list with a single zero amount.
normaliseMixedAmountPreservingFirstPrice :: MixedAmount -> MixedAmount
-- | Simplify a mixed amount's component amounts: we can combine amounts
-- with the same commodity and unit price. Also remove any zero or
-- missing amounts and replace an empty amount list with a single zero
-- amount.
normaliseMixedAmountPreservingPrices :: MixedAmount -> MixedAmount
-- | Convert a mixed amount's component amounts to the commodity of their
-- assigned price, if any.
costOfMixedAmount :: MixedAmount -> MixedAmount
-- | Divide a mixed amount's quantities by a constant.
divideMixedAmount :: MixedAmount -> Double -> MixedAmount
-- | Is this mixed amount negative, if it can be normalised to a single
-- commodity ?
isNegativeMixedAmount :: MixedAmount -> Maybe Bool
-- | Does this mixed amount appear to be zero when displayed with its given
-- precision ?
isZeroMixedAmount :: MixedAmount -> Bool
-- | Is this mixed amount <a>really</a> zero ? See isReallyZeroAmount.
isReallyZeroMixedAmount :: MixedAmount -> Bool
-- | Is this mixed amount <a>really</a> zero, after converting to cost
-- commodities where possible ?
isReallyZeroMixedAmountCost :: MixedAmount -> Bool
-- | Get the string representation of a mixed amount, showing each of its
-- component amounts. NB a mixed amount can have an empty amounts list in
-- which case it shows as "".
showMixedAmount :: MixedAmount -> String
-- | Get an unambiguous string representation of a mixed amount for
-- debugging.
showMixedAmountDebug :: MixedAmount -> String
-- | Get the string representation of a mixed amount, but without any @
-- prices.
showMixedAmountWithoutPrice :: MixedAmount -> String
-- | Get the string representation of a mixed amount, showing each of its
-- component amounts with the specified precision, ignoring their
-- commoditys' display precision settings.
showMixedAmountWithPrecision :: Int -> MixedAmount -> String
-- | Set the display precision in the amount's commodities.
setMixedAmountPrecision :: Int -> MixedAmount -> MixedAmount
-- | Canonicalise a mixed amount's display styles using the provided
-- commodity style map.
canonicaliseMixedAmount :: Map Commodity AmountStyle -> MixedAmount -> MixedAmount
-- | Compact labelled trace of a mixed amount, for debugging.
ltraceamount :: String -> MixedAmount -> MixedAmount
tests_Hledger_Data_Amount :: Test
instance Show HistoricalPrice
instance Num MixedAmount
instance Show MixedAmount
instance Num Amount
instance Show Amount
-- | Date parsing and utilities for hledger.
--
-- For date and time values, we use the standard Day and UTCTime types.
--
-- A <a>SmartDate</a> is a date which may be partially-specified or
-- relative. Eg 2008/12/31, but also 2008/12, 12/31, tomorrow, last week,
-- next year. We represent these as a triple of strings like
-- ("2008","12",""), ("","","tomorrow"), ("","last","week").
--
-- A <a>DateSpan</a> is the span of time between two specific calendar
-- dates, or an open-ended span where one or both dates are unspecified.
-- (A date span with both ends unspecified matches all dates.)
--
-- An <a>Interval</a> is ledger's "reporting interval" - weekly, monthly,
-- quarterly, etc.
module Hledger.Data.Dates
-- | Get the current local date.
getCurrentDay :: IO Day
-- | Get the current local month number.
getCurrentMonth :: IO Int
-- | Get the current local year.
getCurrentYear :: IO Integer
nulldate :: Day
-- | Does the span include the given date ?
spanContainsDate :: DateSpan -> Day -> Bool
-- | Parse a couple of date string formats to a time type.
parsedateM :: String -> Maybe Day
-- | Parse a date string to a time type, or raise an error.
parsedate :: String -> Day
showDate :: Day -> String
showDateSpan :: DateSpan -> [Char]
elapsedSeconds :: Fractional a => UTCTime -> UTCTime -> a
prevday :: Day -> Day
-- | Parse a period expression to an Interval and overall DateSpan using
-- the provided reference date, or return a parse error.
parsePeriodExpr :: Day -> String -> Either ParseError (Interval, DateSpan)
nulldatespan :: DateSpan
tests_Hledger_Data_Dates :: Test
failIfInvalidYear :: Monad m => String -> m ()
datesepchar :: ParsecT [Char] u Identity Char
datesepchars :: [Char]
spanStart :: DateSpan -> Maybe Day
spanEnd :: DateSpan -> Maybe Day
-- | Get overall span enclosing multiple sequentially ordered spans.
spansSpan :: [DateSpan] -> DateSpan
-- | Calculate the intersection of two datespans.
spanIntersect :: DateSpan -> DateSpan -> DateSpan
-- | Calculate the intersection of a number of datespans.
spansIntersect :: [DateSpan] -> DateSpan
-- | Fill any unspecified dates in the first span with the dates from the
-- second one. Sort of a one-way spanIntersect.
spanDefaultsFrom :: DateSpan -> DateSpan -> DateSpan
-- | Calculate the union of two datespans.
spanUnion :: DateSpan -> DateSpan -> DateSpan
-- | Calculate the union of a number of datespans.
spansUnion :: [DateSpan] -> DateSpan
-- | Parse a date in any of the formats allowed in ledger's period
-- expressions, and maybe some others:
--
-- <pre>
-- 2004
-- 2004/10
-- 2004/10/1
-- 10/1
-- 21
-- october, oct
-- yesterday, today, tomorrow
-- this/next/last week/day/month/quarter/year
-- </pre>
--
-- Returns a SmartDate, to be converted to a full date later (see
-- fixSmartDate). Assumes any text in the parse stream has been
-- lowercased.
smartdate :: GenParser Char st SmartDate
-- | Split a DateSpan into one or more consecutive whole spans of the
-- specified length which enclose it. If no interval is specified, the
-- original span is returned.
splitSpan :: Interval -> DateSpan -> [DateSpan]
-- | Convert a SmartDate to an absolute date using the provided reference
-- date.
fixSmartDate :: Day -> SmartDate -> Day
-- | Convert a smart date string to an explicit yyyy/mm/dd string using the
-- provided reference date, or raise an error.
fixSmartDateStr :: Day -> String -> String
-- | A safe version of fixSmartDateStr.
fixSmartDateStrEither :: Day -> String -> Either ParseError String
fixSmartDateStrEither' :: Day -> String -> Either ParseError Day
-- | Count the days in a DateSpan, or if it is open-ended return Nothing.
daysInSpan :: DateSpan -> Maybe Integer
maybePeriod :: Day -> String -> Maybe (Interval, DateSpan)
-- | Make a datespan from two valid date strings parseable by parsedate (or
-- raise an error). Eg: mkdatespan "2011<i>1</i>1" "2011<i>12</i>31".
mkdatespan :: String -> String -> DateSpan
instance Show DateSpan
-- | A <a>Posting</a> represents a change (by some <a>MixedAmount</a>) of
-- the balance in some <a>Account</a>. Each <a>Transaction</a> contains
-- two or more postings which should add up to 0. Postings reference
-- their parent transaction, so we can look up the date or description
-- there.
module Hledger.Data.Posting
nullposting :: Posting
posting :: Posting
post :: AccountName -> Amount -> Posting
-- | Is this posting cleared? If this posting was individually marked as
-- cleared, returns True. Otherwise, return the parent transaction's
-- cleared status or, if there is no parent transaction, return False.
postingCleared :: Posting -> Bool
isReal :: Posting -> Bool
isVirtual :: Posting -> Bool
isBalancedVirtual :: Posting -> Bool
isEmptyPosting :: Posting -> Bool
hasAmount :: Posting -> Bool
-- | Tags for this posting including any inherited from its parent
-- transaction.
postingAllTags :: Posting -> [Tag]
-- | Tags for this transaction including any from its postings.
transactionAllTags :: Transaction -> [Tag]
relatedPostings :: Posting -> [Posting]
-- | Get a posting's (primary) date - it's own primary date if specified,
-- otherwise the parent transaction's primary date, or the null date if
-- there is no parent transaction.
postingDate :: Posting -> Day
-- | Get a posting's secondary (secondary) date, which is the first of:
-- posting's secondary date, transaction's secondary date, posting's
-- primary date, transaction's primary date, or the null date if there is
-- no parent transaction.
postingDate2 :: Posting -> Day
-- | Does this posting fall within the given date span ?
isPostingInDateSpan :: DateSpan -> Posting -> Bool
isPostingInDateSpan' :: WhichDate -> DateSpan -> Posting -> Bool
-- | Get the minimal date span which contains all the postings, or the null
-- date span if there are none.
postingsDateSpan :: [Posting] -> DateSpan
postingsDateSpan' :: WhichDate -> [Posting] -> DateSpan
accountNamesFromPostings :: [Posting] -> [AccountName]
accountNamePostingType :: AccountName -> PostingType
accountNameWithoutPostingType :: AccountName -> AccountName
accountNameWithPostingType :: PostingType -> AccountName -> AccountName
-- | Prefix one account name to another, preserving posting type indicators
-- like concatAccountNames.
joinAccountNames :: AccountName -> AccountName -> AccountName
-- | Join account names into one. If any of them has () or [] posting type
-- indicators, these (the first type encountered) will also be applied to
-- the resulting account name.
concatAccountNames :: [AccountName] -> AccountName
-- | Rewrite an account name using the first applicable alias from the
-- given list, if any.
accountNameApplyAliases :: [(AccountName, AccountName)] -> AccountName -> AccountName
sumPostings :: [Posting] -> MixedAmount
showPosting :: Posting -> String
showComment :: String -> String
tests_Hledger_Data_Posting :: Test
instance Show Posting
-- | An <a>Account</a> has a name, a list of subaccounts, an optional
-- parent account, and subaccounting-excluding and -including balances.
module Hledger.Data.Account
nullacct :: Account
-- | Derive 1. an account tree and 2. their balances from a list of
-- postings. (ledger's core feature). The accounts are returned in a
-- list, but retain their tree structure; the first one is the root of
-- the tree.
accountsFromPostings :: [Posting] -> [Account]
-- | Convert an AccountName tree to an Account tree
nameTreeToAccount :: AccountName -> FastTree AccountName -> Account
-- | Tie the knot so all subaccounts' parents are set correctly.
tieAccountParents :: Account -> Account
-- | Get this account's parent accounts, from the nearest up to the root.
parentAccounts :: Account -> [Account]
-- | List the accounts at each level of the account tree.
accountsLevels :: Account -> [[Account]]
-- | Map a (non-tree-structure-modifying) function over this and sub
-- accounts.
mapAccounts :: (Account -> Account) -> Account -> Account
-- | Is the predicate true on any of this account or its subaccounts ?
anyAccounts :: (Account -> Bool) -> Account -> Bool
-- | Add subaccount-inclusive balances to an account tree.
sumAccounts :: Account -> Account
-- | Remove all subaccounts below a certain depth.
clipAccounts :: Int -> Account -> Account
-- | Remove subaccounts below the specified depth, aggregating their
-- balance at the depth limit (accounts at the depth limit will have any
-- sub-balances merged into their exclusive balance).
clipAccountsAndAggregate :: Int -> [Account] -> [Account]
-- | Remove all leaf accounts and subtrees matching a predicate.
pruneAccounts :: (Account -> Bool) -> Account -> Maybe Account
-- | Flatten an account tree into a list, which is sometimes convenient.
-- Note since accounts link to their parents/subs, the account tree
-- remains intact and can still be used. It's a tree/list!
flattenAccounts :: Account -> [Account]
-- | Filter an account tree (to a list).
filterAccounts :: (Account -> Bool) -> Account -> [Account]
-- | Search an account list by name.
lookupAccount :: AccountName -> [Account] -> Maybe Account
printAccounts :: Account -> IO ()
showAccounts :: Account -> String
showAccountsBoringFlag :: Account -> String
showAccountDebug :: PrintfType ([Char] -> t) => Account -> t
tests_Hledger_Data_Account :: Test
instance Eq Account
instance Show Account
-- | hledger's cmdargs modes parse command-line arguments to an
-- intermediate format, RawOpts (an association list), rather than a
-- fixed ADT like CliOpts. This allows the modes and flags to be reused
-- more easily by hledger commands/scripts in this and other packages.
module Hledger.Data.RawOptions
-- | The result of running cmdargs: an association list of option names to
-- string values.
type RawOpts = [(String, String)]
setopt :: String -> String -> RawOpts -> RawOpts
setboolopt :: String -> RawOpts -> RawOpts
-- | Is the named option present ?
inRawOpts :: String -> RawOpts -> Bool
boolopt :: String -> RawOpts -> Bool
stringopt :: String -> RawOpts -> String
maybestringopt :: String -> RawOpts -> Maybe String
listofstringopt :: String -> RawOpts -> [String]
intopt :: String -> RawOpts -> Int
maybeintopt :: String -> RawOpts -> Maybe Int
-- | Raise an error, showing the specified message plus a hint about
-- --help.
optserror :: String -> a
-- | A <a>Transaction</a> represents a movement of some commodity(ies)
-- between two or more accounts. It consists of multiple account
-- <a>Posting</a>s which balance to zero, a date, and optional extras
-- like description, cleared status, and tags.
module Hledger.Data.Transaction
nulltransaction :: Transaction
-- | Ensure a transaction's postings refer back to it.
txnTieKnot :: Transaction -> Transaction
-- | Show an account name, clipped to the given width if any, and
-- appropriately bracketed/parenthesised for the given posting type.
showAccountName :: Maybe Int -> PostingType -> AccountName -> String
hasRealPostings :: Transaction -> Bool
realPostings :: Transaction -> [Posting]
virtualPostings :: Transaction -> [Posting]
balancedVirtualPostings :: Transaction -> [Posting]
transactionsPostings :: [Transaction] -> [Posting]
-- | Is this transaction balanced ? A balanced transaction's real
-- (non-virtual) postings sum to 0, and any balanced virtual postings
-- also sum to 0.
isTransactionBalanced :: Maybe (Map Commodity AmountStyle) -> Transaction -> Bool
transactionDate2 :: Transaction -> Day
-- | Get the sums of a transaction's real, virtual, and balanced virtual
-- postings.
transactionPostingBalances :: Transaction -> (MixedAmount, MixedAmount, MixedAmount)
-- | Ensure this transaction is balanced, possibly inferring a missing
-- amount or conversion price, or return an error message.
--
-- Balancing is affected by commodity display precisions, so those may be
-- provided.
--
-- We can infer a missing real amount when there are multiple real
-- postings and exactly one of them is amountless (likewise for balanced
-- virtual postings). Inferred amounts are converted to cost basis when
-- possible.
--
-- We can infer a conversion price when all real amounts are specified
-- and the sum of real postings' amounts is exactly two
-- non-explicitly-priced amounts in different commodities (likewise for
-- balanced virtual postings).
balanceTransaction :: Maybe (Map Commodity AmountStyle) -> Transaction -> Either String Transaction
-- | Show a journal transaction, formatted for the print command. ledger
-- 2.x's standard format looks like this:
--
-- <pre>
-- yyyy<i>mm</i>dd[ *][ CODE] description......... [ ; comment...............]
-- account name 1..................... ...$amount1[ ; comment...............]
-- account name 2..................... ..$-amount1[ ; comment...............]
--
-- pcodewidth = no limit -- 10 -- mimicking ledger layout.
-- pdescwidth = no limit -- 20 -- I don't remember what these mean,
-- pacctwidth = 35 minimum, no maximum -- they were important at the time.
-- pamtwidth = 11
-- pcommentwidth = no limit -- 22
-- </pre>
showTransaction :: Transaction -> String
showTransactionUnelided :: Transaction -> String
tests_Hledger_Data_Transaction :: Test
instance Show PeriodicTransaction
instance Show ModifierTransaction
instance Show Transaction
-- | A <a>TimeLogEntry</a> is a clock-in, clock-out, or other directive in
-- a timelog file (see timeclock.el or the command-line version). These
-- can be converted to <tt>Transactions</tt> and queried like a ledger.
module Hledger.Data.TimeLog
-- | Convert time log entries to journal transactions. When there is no
-- clockout, add one with the provided current time. Sessions crossing
-- midnight are split into days to give accurate per-day totals.
timeLogEntriesToTransactions :: LocalTime -> [TimeLogEntry] -> [Transaction]
-- | Convert a timelog clockin and clockout entry to an equivalent journal
-- transaction, representing the time expenditure. Note this entry is not
-- balanced, since we omit the "assets:time" transaction for simpler
-- output.
entryFromTimeLogInOut :: TimeLogEntry -> TimeLogEntry -> Transaction
tests_Hledger_Data_TimeLog :: Test
instance Read TimeLogCode
instance Show TimeLogCode
instance Show TimeLogEntry
-- | A general query system for matching things (accounts, postings,
-- transactions..) by various criteria, and a parser for query
-- expressions.
module Hledger.Query
-- | A query is a composition of search criteria, which can be used to
-- match postings, transactions, accounts and more.
data Query
-- | always match
Any :: Query
-- | never match
None :: Query
-- | negate this match
Not :: Query -> Query
-- | match if any of these match
Or :: [Query] -> Query
-- | match if all of these match
And :: [Query] -> Query
-- | match if code matches this regexp
Code :: String -> Query
-- | match if description matches this regexp
Desc :: String -> Query
-- | match postings whose account matches this regexp
Acct :: String -> Query
-- | match if primary date in this date span
Date :: DateSpan -> Query
-- | match if secondary date in this date span
Date2 :: DateSpan -> Query
-- | match if cleared status has this value
Status :: Bool -> Query
-- | match if <a>realness</a> (involves a real non-virtual account ?) has
-- this value
Real :: Bool -> Query
-- | match if the amount's numeric quantity is less than<i>greater
-- than</i>equal to/unsignedly equal to some value
Amt :: OrdPlus -> Quantity -> Query
-- | match if the entire commodity symbol is matched by this regexp
Sym :: String -> Query
-- | if true, show zero-amount postings/accounts which are usually not
-- shown more of a query option than a query criteria ?
Empty :: Bool -> Query
-- | match if account depth is less than or equal to this value
Depth :: Int -> Query
-- | match if a tag with this exact name, and with value matching the
-- regexp if provided, exists
Tag :: String -> (Maybe String) -> Query
-- | A query option changes a query's/report's behaviour and output in some
-- way.
data QueryOpt
-- | show an account register focussed on this account
QueryOptInAcctOnly :: AccountName -> QueryOpt
-- | as above but include sub-accounts in the account register |
-- QueryOptCostBasis -- ^ show amounts converted to cost where possible |
-- QueryOptDate2 -- ^ show secondary dates instead of primary dates
QueryOptInAcct :: AccountName -> QueryOpt
-- | Convert a query expression containing zero or more space-separated
-- terms to a query and zero or more query options. A query term is
-- either:
--
-- <ol>
-- <li>a search pattern, which matches on one or more fields, eg:</li>
-- </ol>
--
-- acct:REGEXP - match the account name with a regular expression
-- desc:REGEXP - match the transaction description date:PERIODEXP - match
-- the date with a period expression
--
-- The prefix indicates the field to match, or if there is no prefix
-- account name is assumed.
--
-- <ol>
-- <li>a query option, which modifies the reporting behaviour in some
-- way. There is currently one of these, which may appear only once:</li>
-- </ol>
--
-- inacct:FULLACCTNAME
--
-- The usual shell quoting rules are assumed. When a pattern contains
-- whitespace, it (or the whole term including prefix) should be enclosed
-- in single or double quotes.
--
-- Period expressions may contain relative dates, so a reference date is
-- required to fully parse these.
--
-- Multiple terms are combined as follows: 1. multiple account patterns
-- are OR'd together 2. multiple description patterns are OR'd together
-- 3. then all terms are AND'd together
parseQuery :: Day -> String -> (Query, [QueryOpt])
simplifyQuery :: Query -> Query
-- | Remove query terms (or whole sub-expressions) not matching the given
-- predicate from this query. XXX Semantics not yet clear.
filterQuery :: (Query -> Bool) -> Query -> Query
-- | Does this query match everything ?
queryIsNull :: Query -> Bool
queryIsAcct :: Query -> Bool
queryIsDepth :: Query -> Bool
queryIsDate :: Query -> Bool
-- | Does this query specify a start date and nothing else (that would
-- filter postings prior to the date) ? When the flag is true, look for a
-- starting secondary date instead.
queryIsStartDateOnly :: Bool -> Query -> Bool
queryIsSym :: Query -> Bool
-- | What start date (or secondary date) does this query specify, if any ?
-- For OR expressions, use the earliest of the dates. NOT is ignored.
queryStartDate :: Bool -> Query -> Maybe Day
-- | What date span (or secondary date span) does this query specify ? For
-- OR expressions, use the widest possible span. NOT is ignored.
queryDateSpan :: Bool -> Query -> DateSpan
-- | The depth limit this query specifies, or a large number if none.
queryDepth :: Query -> Int
-- | The empty (zero amount) status specified by this query, defaulting to
-- false.
queryEmpty :: Query -> Bool
-- | The account we are currently focussed on, if any, and whether
-- subaccounts are included. Just looks at the first query option.
inAccount :: [QueryOpt] -> Maybe (AccountName, Bool)
-- | A query for the account(s) we are currently focussed on, if any. Just
-- looks at the first query option.
inAccountQuery :: [QueryOpt] -> Maybe Query
-- | Does the match expression match this transaction ?
matchesTransaction :: Query -> Transaction -> Bool
-- | Does the match expression match this posting ?
matchesPosting :: Query -> Posting -> Bool
-- | Does the match expression match this account ? A matching in: clause
-- is also considered a match.
matchesAccount :: Query -> AccountName -> Bool
matchesMixedAmount :: Query -> MixedAmount -> Bool
-- | Does the match expression match this (simple) amount ?
matchesAmount :: Query -> Amount -> Bool
-- | Quote-and-prefix-aware version of words - don't split on spaces which
-- are inside quotes, including quotes which may have one of the
-- specified prefixes in front, and maybe an additional not: prefix in
-- front of that.
words'' :: [String] -> String -> [String]
tests_Hledger_Query :: Test
instance Typeable QueryOpt
instance Typeable OrdPlus
instance Typeable Query
instance Show QueryOpt
instance Eq QueryOpt
instance Data QueryOpt
instance Show OrdPlus
instance Eq OrdPlus
instance Data OrdPlus
instance Eq Query
instance Data Query
instance Show Query
-- | A <a>Journal</a> is a set of transactions, plus optional related data.
-- This is hledger's primary data object. It is usually parsed from a
-- journal file or other data format (see <a>Hledger.Read</a>).
module Hledger.Data.Journal
addHistoricalPrice :: HistoricalPrice -> Journal -> Journal
addModifierTransaction :: ModifierTransaction -> Journal -> Journal
addPeriodicTransaction :: PeriodicTransaction -> Journal -> Journal
addTimeLogEntry :: TimeLogEntry -> Journal -> Journal
addTransaction :: Transaction -> Journal -> Journal
-- | Apply additional account aliases (eg from the command-line) to all
-- postings in a journal.
journalApplyAliases :: [(AccountName, AccountName)] -> Journal -> Journal
-- | Fill in any missing amounts and check that all journal transactions
-- balance, or return an error message. This is done after parsing all
-- amounts and working out the canonical commodities, since balancing
-- depends on display precision. Reports only the first error
-- encountered.
journalBalanceTransactions :: Journal -> Either String Journal
-- | Convert all the journal's posting amounts (not price amounts) to their
-- canonical display settings. Ie, all amounts in a given commodity will
-- use (a) the display settings of the first, and (b) the greatest
-- precision, of the posting amounts in that commodity.
journalCanonicaliseAmounts :: Journal -> Journal
-- | Convert all this journal's amounts to cost by applying their prices,
-- if any.
journalConvertAmountsToCost :: Journal -> Journal
-- | Do post-parse processing on a journal to make it ready for use: check
-- all transactions balance, canonicalise amount formats, close any open
-- timelog entries and so on.
journalFinalise :: ClockTime -> LocalTime -> FilePath -> String -> JournalContext -> Journal -> Either String Journal
-- | Keep only transactions matching the query expression.
filterJournalTransactions :: Query -> Journal -> Journal
-- | Keep only postings matching the query expression. This can leave
-- unbalanced transactions.
filterJournalPostings :: Query -> Journal -> Journal
filterJournalPostingAmounts :: Query -> Journal -> Journal
-- | Filter out all parts of this posting's amount which do not match the
-- query.
filterPostingAmount :: Query -> Posting -> Posting
-- | Unique account names in this journal, including parent accounts
-- containing no postings.
journalAccountNames :: Journal -> [AccountName]
-- | Unique account names posted to in this journal.
journalAccountNamesUsed :: Journal -> [AccountName]
-- | Get all this journal's component amounts, roughly in the order parsed.
journalAmounts :: Journal -> [Amount]
-- | The fully specified date span enclosing the dates (primary or
-- secondary) of all this journal's transactions and postings, or
-- DateSpan Nothing Nothing if there are none.
journalDateSpan :: Bool -> Journal -> DateSpan
-- | Unique transaction descriptions used in this journal.
journalDescriptions :: Journal -> [String]
journalFilePath :: Journal -> FilePath
journalFilePaths :: Journal -> [FilePath]
-- | All postings from this journal's transactions, in order.
journalPostings :: Journal -> [Posting]
-- | A query for Asset, Liability & Equity accounts in this journal. Cf
-- <a>http://en.wikipedia.org/wiki/Chart_of_accounts#Balance_Sheet_Accounts</a>.
journalBalanceSheetAccountQuery :: Journal -> Query
-- | A query for Profit & Loss accounts in this journal. Cf
-- <a>http://en.wikipedia.org/wiki/Chart_of_accounts#Profit_.26_Loss_accounts</a>.
journalProfitAndLossAccountQuery :: Journal -> Query
-- | A query for Income (Revenue) accounts in this journal. This is
-- currently hard-coded to the case-insensitive regex
-- <tt>^(income|revenue)s?(:|$)</tt>.
journalIncomeAccountQuery :: Journal -> Query
-- | A query for Expense accounts in this journal. This is currently
-- hard-coded to the case-insensitive regex <tt>^expenses?(:|$)</tt>.
journalExpenseAccountQuery :: Journal -> Query
-- | A query for Asset accounts in this journal. This is currently
-- hard-coded to the case-insensitive regex <tt>^assets?(:|$)</tt>.
journalAssetAccountQuery :: Journal -> Query
-- | A query for Liability accounts in this journal. This is currently
-- hard-coded to the case-insensitive regex
-- <tt>^liabilit(y|ies)(:|$)</tt>.
journalLiabilityAccountQuery :: Journal -> Query
-- | A query for Equity accounts in this journal. This is currently
-- hard-coded to the case-insensitive regex <tt>^equity(:|$)</tt>.
journalEquityAccountQuery :: Journal -> Query
-- | A query for Cash (-equivalent) accounts in this journal (ie, accounts
-- which appear on the cashflow statement.) This is currently hard-coded
-- to be all the Asset accounts except for those containing the
-- case-insensitive regex <tt>(receivable|A/R)</tt>.
journalCashAccountQuery :: Journal -> Query
-- | Check if a set of hledger account/description filter patterns matches
-- the given account name or entry description. Patterns are
-- case-insensitive regular expressions. Prefixed with not:, they become
-- anti-patterns.
matchpats :: [String] -> String -> Bool
nullctx :: JournalContext
nulljournal :: Journal
samplejournal :: Journal
tests_Hledger_Data_Journal :: Test
instance Show Journal
-- | A <a>Ledger</a> is derived from a <a>Journal</a> by applying a filter
-- specification to select <a>Transaction</a>s and <a>Posting</a>s of
-- interest. It contains the filtered journal and knows the resulting
-- chart of accounts, account balances, and postings in each account.
module Hledger.Data.Ledger
nullledger :: Ledger
-- | Filter a journal's transactions with the given query, then derive a
-- ledger containing the chart of accounts and balances. If the query
-- includes a depth limit, that will affect the this ledger's journal but
-- not the ledger's account tree.
ledgerFromJournal :: Query -> Journal -> Ledger
-- | List a ledger's account names.
ledgerAccountNames :: Ledger -> [AccountName]
-- | Get the named account from a ledger.
ledgerAccount :: Ledger -> AccountName -> Maybe Account
-- | Get this ledger's root account, which is a dummy <a>root</a> account
-- above all others. This should always be first in the account list, if
-- somehow not this returns a null account.
ledgerRootAccount :: Ledger -> Account
-- | List a ledger's top-level accounts (the ones below the root), in tree
-- order.
ledgerTopAccounts :: Ledger -> [Account]
-- | List a ledger's bottom-level (subaccount-less) accounts, in tree
-- order.
ledgerLeafAccounts :: Ledger -> [Account]
-- | Accounts in ledger whose name matches the pattern, in tree order.
ledgerAccountsMatching :: [String] -> Ledger -> [Account]
-- | List a ledger's postings, in the order parsed.
ledgerPostings :: Ledger -> [Posting]
-- | The (fully specified) date span containing all the ledger's (filtered)
-- transactions, or DateSpan Nothing Nothing if there are none.
ledgerDateSpan :: Ledger -> DateSpan
-- | All commodities used in this ledger.
ledgerCommodities :: Ledger -> [Commodity]
tests_ledgerFromJournal :: [Test]
tests_Hledger_Data_Ledger :: Test
instance Show Ledger
-- | The Hledger.Data library allows parsing and querying of C++
-- ledger-style journal files. It generally provides a compatible subset
-- of C++ ledger's functionality. This package re-exports all the
-- Hledger.Data.* modules (except UTF8, which requires an explicit
-- import.)
module Hledger.Data
tests_Hledger_Data :: Test
-- | A reader for hledger's journal file format
-- (<a>http://hledger.org/MANUAL.html#the-journal-file</a>). hledger's
-- journal format is a compatible subset of c++ ledger's
-- (<a>http://ledger-cli.org/3.0/doc/ledger3.html#Journal-Format</a>), so
-- this reader should handle many ledger files as well. Example:
--
-- <pre>
-- 2012/3/24 gift
-- expenses:gifts $10
-- assets:cash
-- </pre>
module Hledger.Read.JournalReader
reader :: Reader
-- | Given a JournalUpdate-generating parsec parser, file path and data
-- string, parse and post-process a Journal so that it's ready to use, or
-- give an error.
parseJournalWith :: (GenParser Char JournalContext (JournalUpdate, JournalContext)) -> FilePath -> String -> ErrorT String IO Journal
getParentAccount :: GenParser tok JournalContext String
-- | Top-level journal parser. Returns a single composite, I/O performing,
-- error-raising <a>JournalUpdate</a> (and final <a>JournalContext</a>)
-- which can be applied to an empty journal to get the final result.
journal :: GenParser Char JournalContext (JournalUpdate, JournalContext)
directive :: GenParser Char JournalContext JournalUpdate
defaultyeardirective :: GenParser Char JournalContext JournalUpdate
historicalpricedirective :: GenParser Char JournalContext HistoricalPrice
-- | Parse a date and time in YYYY<i>MM</i>DD HH:MM[:SS][+-ZZZZ] format.
-- Any timezone will be ignored; the time is treated as local time. Fewer
-- digits are allowed, except in the timezone. The year may be omitted if
-- a default year has already been set.
datetimep :: GenParser Char JournalContext LocalTime
codep :: GenParser Char JournalContext String
-- | Parse an account name. Account names may have single spaces inside
-- them, and are terminated by two or more spaces. They should have one
-- or more components of at least one character, separated by the account
-- separator char.
accountnamep :: GenParser Char st AccountName
postingp :: GenParser Char JournalContext Posting
-- | Parse a single-commodity amount, with optional symbol on the left or
-- right, optional unit or total price, and optional (ignored)
-- ledger-style balance assertion or fixed lot price declaration.
amountp :: GenParser Char JournalContext Amount
-- | Parse an amount from a string, or get an error.
amountp' :: String -> Amount
-- | Parse a mixed amount from a string, or get an error.
mamountp' :: String -> MixedAmount
-- | Parse a numeric quantity for its value and display attributes. Some
-- international number formats (cf
-- http:<i></i>en.wikipedia.org<i>wiki</i>Decimal_separator) are
-- accepted: either period or comma may be used for the decimal point,
-- and the other of these may be used for separating digit groups in the
-- integer part (eg a thousands separator). This returns the numeric
-- value, the precision (number of digits to the right of the decimal
-- point), the decimal point and separator characters (defaulting to .
-- and ,), and the positions of separators (counting leftward from the
-- decimal point, the last is assumed to repeat).
numberp :: GenParser Char JournalContext (Quantity, Int, Char, Char, [Int])
emptyorcommentlinep :: GenParser Char JournalContext ()
followingcommentp :: GenParser Char JournalContext String
-- | A reader for the timelog file format generated by timeclock.el
-- (<a>http://www.emacswiki.org/emacs/TimeClock</a>). Example:
--
-- <pre>
-- i 2007/03/10 12:26:00 hledger
-- o 2007/03/10 17:26:02
-- </pre>
--
-- From timeclock.el 2.6:
--
-- <pre>
-- A timelog contains data in the form of a single entry per line.
-- Each entry has the form:
--
-- CODE YYYY<i>MM</i>DD HH:MM:SS [COMMENT]
--
-- CODE is one of: b, h, i, o or O. COMMENT is optional when the code is
-- i, o or O. The meanings of the codes are:
--
-- b Set the current time balance, or "time debt". Useful when
-- archiving old log data, when a debt must be carried forward.
-- The COMMENT here is the number of seconds of debt.
--
-- h Set the required working time for the given day. This must
-- be the first entry for that day. The COMMENT in this case is
-- the number of hours in this workday. Floating point amounts
-- are allowed.
--
-- i Clock in. The COMMENT in this case should be the name of the
-- project worked on.
--
-- o Clock out. COMMENT is unnecessary, but can be used to provide
-- a description of how the period went, for example.
--
-- O Final clock out. Whatever project was being worked on, it is
-- now finished. Useful for creating summary reports.
-- </pre>
module Hledger.Read.TimelogReader
reader :: Reader
tests_Hledger_Read_TimelogReader :: Test
-- | A reader for CSV data, using an extra rules file to help interpret the
-- data.
module Hledger.Read.CsvReader
reader :: Reader
type CsvRecord = [String]
rulesFileFor :: FilePath -> FilePath
parseRulesFile :: FilePath -> IO (Either ParseError CsvRules)
transactionFromCsvRecord :: CsvRules -> CsvRecord -> Transaction
tests_Hledger_Read_CsvReader :: Test
instance Show CsvRules
instance Eq CsvRules
-- | This is the entry point to hledger's reading system, which can read
-- Journals from various data formats. Use this module if you want to
-- parse journal data or read journal files. Generally it should not be
-- necessary to import modules below this one.
module Hledger.Read
-- | All the data formats we can read. formats = map rFormat readers
--
-- Get the default journal file path specified by the environment. Like
-- ledger, we look first for the LEDGER_FILE environment variable, and if
-- that does not exist, for the legacy LEDGER environment variable. If
-- neither is set, or the value is blank, return the hard-coded default,
-- which is <tt>.hledger.journal</tt> in the users's home directory (or
-- in the current directory, if we cannot determine a home directory).
defaultJournalPath :: IO String
-- | Read the default journal file specified by the environment, or raise
-- an error.
defaultJournal :: IO Journal
-- | Read a journal from this string, trying whatever readers seem
-- appropriate:
--
-- <ul>
-- <li>if a format is specified, try that reader only</li>
-- <li>or if one or more readers recognises the file path and data, try
-- those</li>
-- <li>otherwise, try them all.</li>
-- </ul>
--
-- A CSV conversion rules file may also be specified for use by the CSV
-- reader.
readJournal :: Maybe StorageFormat -> Maybe FilePath -> Maybe FilePath -> String -> IO (Either String Journal)
-- | Read a journal from the given string, trying all known formats, or
-- simply throw an error.
readJournal' :: String -> IO Journal
-- | Read a Journal from this file (or stdin if the filename is -) or give
-- an error message, using the specified data format or trying all known
-- formats. A CSV conversion rules file may be specified for better
-- conversion of that format.
readJournalFile :: Maybe StorageFormat -> Maybe FilePath -> FilePath -> IO (Either String Journal)
-- | If the specified journal file does not exist, give a helpful error and
-- quit.
requireJournalFileExists :: FilePath -> IO ()
-- | Ensure there is a journal file at the given path, creating an empty
-- one if needed.
ensureJournalFileExists :: FilePath -> IO ()
postingp :: GenParser Char JournalContext Posting
-- | Parse an account name. Account names may have single spaces inside
-- them, and are terminated by two or more spaces. They should have one
-- or more components of at least one character, separated by the account
-- separator char.
accountnamep :: GenParser Char st AccountName
-- | Parse a single-commodity amount, with optional symbol on the left or
-- right, optional unit or total price, and optional (ignored)
-- ledger-style balance assertion or fixed lot price declaration.
amountp :: GenParser Char JournalContext Amount
-- | Parse an amount from a string, or get an error.
amountp' :: String -> Amount
-- | Parse a mixed amount from a string, or get an error.
mamountp' :: String -> MixedAmount
-- | Parse a numeric quantity for its value and display attributes. Some
-- international number formats (cf
-- http:<i></i>en.wikipedia.org<i>wiki</i>Decimal_separator) are
-- accepted: either period or comma may be used for the decimal point,
-- and the other of these may be used for separating digit groups in the
-- integer part (eg a thousands separator). This returns the numeric
-- value, the precision (number of digits to the right of the decimal
-- point), the decimal point and separator characters (defaulting to .
-- and ,), and the positions of separators (counting leftward from the
-- decimal point, the last is assumed to repeat).
numberp :: GenParser Char JournalContext (Quantity, Int, Char, Char, [Int])
codep :: GenParser Char JournalContext String
samplejournal :: IO Journal
tests_Hledger_Read :: Test
-- | Options common to most hledger reports.
module Hledger.Reports.ReportOptions
-- | Standard options for customising report filtering and output,
-- corresponding to hledger's command-line options and query language
-- arguments. Used in hledger-lib and above.
data ReportOpts
ReportOpts :: Maybe Day -> Maybe Day -> Maybe (Interval, DateSpan) -> Bool -> Bool -> Bool -> Maybe Int -> Maybe DisplayExp -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe FormatStr -> String -> Bool -> Bool -> BalanceType -> Bool -> Bool -> Int -> Bool -> ReportOpts
begin_ :: ReportOpts -> Maybe Day
end_ :: ReportOpts -> Maybe Day
period_ :: ReportOpts -> Maybe (Interval, DateSpan)
cleared_ :: ReportOpts -> Bool
uncleared_ :: ReportOpts -> Bool
cost_ :: ReportOpts -> Bool
depth_ :: ReportOpts -> Maybe Int
display_ :: ReportOpts -> Maybe DisplayExp
date2_ :: ReportOpts -> Bool
empty_ :: ReportOpts -> Bool
no_elide_ :: ReportOpts -> Bool
real_ :: ReportOpts -> Bool
daily_ :: ReportOpts -> Bool
weekly_ :: ReportOpts -> Bool
monthly_ :: ReportOpts -> Bool
quarterly_ :: ReportOpts -> Bool
yearly_ :: ReportOpts -> Bool
format_ :: ReportOpts -> Maybe FormatStr
query_ :: ReportOpts -> String
average_ :: ReportOpts -> Bool
related_ :: ReportOpts -> Bool
balancetype_ :: ReportOpts -> BalanceType
flat_ :: ReportOpts -> Bool
tree_ :: ReportOpts -> Bool
drop_ :: ReportOpts -> Int
no_total_ :: ReportOpts -> Bool
-- | Which balance is being shown in a multi-column balance report.
data BalanceType
-- | The change of balance in each period.
PeriodBalance :: BalanceType
-- | The accumulated balance at each period's end, starting from zero at
-- the report start date.
CumulativeBalance :: BalanceType
-- | The historical balance at each period's end, starting from the account
-- balances at the report start date.
HistoricalBalance :: BalanceType
type FormatStr = String
defreportopts :: ReportOpts
rawOptsToReportOpts :: RawOpts -> IO ReportOpts
-- | Figure out the date span we should report on, based on any
-- begin<i>end</i>period options provided. A period option will cause
-- begin and end options to be ignored.
dateSpanFromOpts :: Day -> ReportOpts -> DateSpan
-- | Figure out the reporting interval, if any, specified by the options.
-- --period overrides --daily overrides --weekly overrides --monthly etc.
intervalFromOpts :: ReportOpts -> Interval
-- | Get a maybe boolean representing the last cleared/uncleared option if
-- any.
clearedValueFromOpts :: ReportOpts -> Maybe Bool
-- | Report which date we will report on based on --date2.
whichDateFromOpts :: ReportOpts -> WhichDate
-- | Convert this journal's postings' amounts to the cost basis amounts if
-- specified by options.
journalSelectingAmountFromOpts :: ReportOpts -> Journal -> Journal
-- | Convert report options and arguments to a query.
queryFromOpts :: Day -> ReportOpts -> Query
-- | Convert report options to a query, ignoring any non-flag command line
-- arguments.
queryFromOptsOnly :: Day -> ReportOpts -> Query
-- | Convert report options and arguments to query options.
queryOptsFromOpts :: Day -> ReportOpts -> [QueryOpt]
-- | Select the Transaction date accessor based on --date2.
transactionDateFn :: ReportOpts -> (Transaction -> Day)
-- | Select the Posting date accessor based on --date2.
postingDateFn :: ReportOpts -> (Posting -> Day)
tests_Hledger_Reports_ReportOptions :: Test
instance Typeable BalanceType
instance Typeable ReportOpts
instance Eq BalanceType
instance Show BalanceType
instance Data BalanceType
instance Show ReportOpts
instance Data ReportOpts
instance Default ReportOpts
instance Default BalanceType
-- | Journal entries report, used by the print command.
module Hledger.Reports.EntriesReport
-- | A journal entries report is a list of whole transactions as originally
-- entered in the journal (mostly). This is used by eg hledger's print
-- command and hledger-web's journal entries view.
type EntriesReport = [EntriesReportItem]
type EntriesReportItem = Transaction
-- | Select transactions for an entries report.
entriesReport :: ReportOpts -> Query -> Journal -> EntriesReport
tests_Hledger_Reports_EntriesReport :: Test
-- | Postings report, used by the register command.
module Hledger.Reports.PostingsReport
-- | A postings report is a list of postings with a running total, a label
-- for the total field, and a little extra transaction info to help with
-- rendering. This is used eg for the register command.
type PostingsReport = (String, [PostingsReportItem])
type PostingsReportItem = (Maybe Day, Maybe String, Posting, MixedAmount)
-- | Select postings from the journal and add running balance and other
-- information to make a postings report. Used by eg hledger's register
-- command.
postingsReport :: ReportOpts -> Query -> Journal -> PostingsReport
-- | Generate one postings report line item, containing the posting, the
-- current running balance, and optionally the posting date and/or the
-- transaction description.
mkpostingsReportItem :: Bool -> Bool -> WhichDate -> Posting -> MixedAmount -> PostingsReportItem
tests_Hledger_Reports_PostingsReport :: Test
-- | Whole-journal, account-centric, and per-commodity transactions
-- reports, used by hledger-web.
module Hledger.Reports.TransactionsReports
-- | A transactions report includes a list of transactions
-- (posting-filtered and unfiltered variants), a running balance, and
-- some other information helpful for rendering a register view (a flag
-- indicating multiple other accounts and a display string describing
-- them) with or without a notion of current account(s). Two kinds of
-- report use this data structure, see journalTransactionsReport and
-- accountTransactionsReport below for detais.
type TransactionsReport = (String, [TransactionsReportItem])
type TransactionsReportItem = (Transaction, Transaction, Bool, String, MixedAmount, MixedAmount)
triDate :: (Transaction, t, t1, t2, t3, t4) -> Day
triBalance :: (t, t1, t2, t3, t4, t5) -> t5
triSimpleBalance :: (t, t1, t2, t3, t4, MixedAmount) -> [Char]
-- | Select transactions from the whole journal. This is similar to a
-- <a>postingsReport</a> except with transaction-based report items which
-- are ordered most recent first. This is used by eg hledger-web's
-- journal view.
journalTransactionsReport :: ReportOpts -> Journal -> Query -> TransactionsReport
-- | Select transactions within one or more current accounts, and make a
-- transactions report relative to those account(s). This means:
--
-- <ol>
-- <li>it shows transactions from the point of view of the current
-- account(s). The transaction amount is the amount posted to the current
-- account(s). The other accounts' names are provided.</li>
-- <li>With no transaction filtering in effect other than a start date,
-- it shows the accurate historical running balance for the current
-- account(s). Otherwise it shows a running total starting at 0.</li>
-- </ol>
--
-- This is used by eg hledger-web's account register view. Currently,
-- reporting intervals are not supported, and report items are most
-- recent first.
accountTransactionsReport :: ReportOpts -> Journal -> Query -> Query -> TransactionsReport
-- | Split a transactions report whose items may involve several
-- commodities, into one or more single-commodity transactions reports.
transactionsReportByCommodity :: TransactionsReport -> [TransactionsReport]
-- | Balance report, used by the balance command.
module Hledger.Reports.BalanceReport
-- | A simple single-column balance report. It has:
--
-- <ol>
-- <li>a list of rows, each containing a renderable account name and a
-- corresponding amount</li>
-- <li>the final total of the amounts</li>
-- </ol>
type BalanceReport = ([BalanceReportItem], MixedAmount)
type BalanceReportItem = (RenderableAccountName, MixedAmount)
-- | A renderable account name includes some additional hints for rendering
-- accounts in a balance report. It has:
--
-- <ul>
-- <li>The full account name</li>
-- <li>The ledger-style short elided account name (the leaf name,
-- prefixed by any boring parents immediately above)</li>
-- <li>The number of indentation steps to use when rendering a
-- ledger-style account tree (normally the 0-based depth of this account
-- excluding boring parents, or 0 with --flat).</li>
-- </ul>
type RenderableAccountName = (AccountName, AccountName, Int)
-- | Enabling this makes balance --flat --empty also show parent accounts
-- without postings, in addition to those with postings and a zero
-- balance. Disabling it shows only the latter. No longer supported, but
-- leave this here for a bit. flatShowsPostinglessAccounts = True
--
-- Generate a simple balance report, containing the matched accounts and
-- their balances (change of balance) during the specified period. This
-- is like periodBalanceReport with a single column (but more mature, eg
-- this can do hierarchical display).
balanceReport :: ReportOpts -> Query -> Journal -> BalanceReport
-- | When true (the default), this makes balance --flat reports and their
-- implementation clearer. Single/multi-col balance reports currently
-- aren't all correct if this is false.
flatShowsExclusiveBalance :: Bool
tests_Hledger_Reports_BalanceReport :: Test
-- | Multi-column balance reports, used by the balance command.
module Hledger.Reports.MultiBalanceReports
-- | A multi balance report is a balance report with one or more columns.
-- It has:
--
-- <ol>
-- <li>a list of each column's date span</li>
-- <li>a list of rows, each containing a renderable account name and the
-- amounts to show in each column</li>
-- <li>a list of each column's final total</li>
-- </ol>
--
-- The meaning of the amounts depends on the type of multi balance
-- report, of which there are three: periodic, cumulative and historical
-- (see <a>BalanceType</a> and <a>Hledger.Cli.Balance</a>).
newtype MultiBalanceReport
MultiBalanceReport :: ([DateSpan], [MultiBalanceReportRow], [MixedAmount]) -> MultiBalanceReport
-- | A row in a multi balance report has
--
-- <ul>
-- <li>An account name, with rendering hints</li>
-- <li>A list of amounts to be shown in each of the report's
-- columns.</li>
-- </ul>
type MultiBalanceReportRow = (RenderableAccountName, [MixedAmount])
-- | Generate a multicolumn balance report for the matched accounts,
-- showing the change of balance, accumulated balance, or historical
-- balance in each of the specified periods.
multiBalanceReport :: ReportOpts -> Query -> Journal -> MultiBalanceReport
instance Show MultiBalanceReport
-- | Account balance history report.
module Hledger.Reports.BalanceHistoryReport
-- | Get the historical running inclusive balance of a particular account,
-- from earliest to latest posting date.
accountBalanceHistory :: ReportOpts -> Journal -> Account -> [(Day, MixedAmount)]
-- | Generate several common kinds of report from a journal, as "*Report" -
-- simple intermediate data structures intended to be easily rendered as
-- text, html, json, csv etc. by hledger commands, hamlet templates,
-- javascript, or whatever.
module Hledger.Reports
tests_Hledger_Reports :: Test
module Hledger
tests_Hledger :: Test
|