-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A terminal UI as drop-in replacement for hledger add
--   
--   This is a terminal UI as drop-in replacement for hledger add.
--   
--   It improves in the following ways on hledger's add command:
--   
--   <ul>
--   <li>Interactive as-you-type completion for account names and
--   descriptions with optional fuzzy matching.</li>
--   <li>Integrated calculator: Amounts can be written as simple sums with
--   real-time feedback on the result.</li>
--   <li>All actions while entering a transaction can be undone</li>
--   <li>Configurable format for date input. Instead of <tt>y/m/d</tt> it
--   is also possible to use other formats like the german
--   <tt>d.m.y</tt>.</li>
--   </ul>
@package hledger-iadd
@version 1.3.5

module Brick.Widgets.BetterDialog
dialog :: Text -> Text -> Widget n


-- | Extensions to <a>Brick.Widgets.Border</a>
module Brick.Widgets.Border.Utils

-- | Draw a vertical border on the left side of a widget.
borderLeft :: Widget n -> Widget n


-- | Widget like <a>Brick.Widgets.Edit</a>, but with more emacs style
--   keybindings.
--   
--   This is also a complete wrapper around the <a>Brick.Widgets.Edit</a>
--   API to retain compatability with older brick versions.
--   
--   See <a>handleEditorEvent</a> for a list of added keybindings.
module Brick.Widgets.Edit.EmacsBindings

-- | Wrapper around <a>Editor</a>, but specialized to <a>Text</a>
data Editor n

-- | Wrapper for <a>editorText</a> specialized to <a>Text</a>
editorText :: n -> ([Text] -> Widget n) -> Maybe Int -> Text -> Editor n

-- | Wrapper for <a>getEditContents</a> specialized to <a>Text</a>
getEditContents :: Editor n -> [Text]

-- | Wrapper for <a>applyEdit</a> specialized to <a>Text</a>
applyEdit :: (TextZipper Text -> TextZipper Text) -> Editor n -> Editor n

-- | Wrapper for <a>editContentsL</a> specialized to <a>Text</a>
editContentsL :: Lens (Editor n) (Editor n) (TextZipper Text) (TextZipper Text)

-- | Same as <a>handleEditorEvent</a>, but with more emacs-style
--   keybindings and specialized to <a>Text</a>
--   
--   Specifically:
--   
--   <ul>
--   <li>Ctrl-f: Move forward one character</li>
--   <li>Ctrl-b: Move backward one character</li>
--   <li>Alt-f: Move forward one word</li>
--   <li>Alt-b: Move backward one word</li>
--   <li>Alt-Backspace: Delete the previous word</li>
--   <li>Ctrl-w: Delete the previous word</li>
--   <li>Alt-d: Delete the next word</li>
--   </ul>
handleEditorEvent :: Event -> Editor n -> EventM n (Editor n)

-- | Wrapper for <a>renderEditor</a> specialized to <a>Text</a>
renderEditor :: (Ord n, Show n) => Bool -> Editor n -> Widget n

module Brick.Widgets.CommentDialog
data CommentWidget n
commentWidget :: n -> Text -> Text -> CommentWidget n
renderCommentWidget :: (Ord n, Show n) => CommentWidget n -> Widget n
commentDialogComment :: CommentWidget n -> Text
data CommentAction n
CommentContinue :: (CommentWidget n) -> CommentAction n
CommentFinished :: Text -> CommentAction n
handleCommentEvent :: Event -> CommentWidget n -> EventM n (CommentAction n)

module Brick.Widgets.HelpMessage
data HelpWidget n
type Title = Text
newtype KeyBindings
KeyBindings :: [(Title, [(Text, Text)])] -> KeyBindings
helpWidget :: n -> KeyBindings -> HelpWidget n
renderHelpWidget :: Name n => HelpWidget n -> Widget n
helpAttr :: AttrName
resetHelpWidget :: HelpWidget n -> EventM n ()
handleHelpEvent :: HelpWidget n -> Event -> EventM n (HelpWidget n)

module Brick.Widgets.List.Utils

-- | Replace the contents of a list with a new set of elements but preserve
--   the currently selected index.
--   
--   This is a version of listReplace that doesn't try to be smart, but
--   assumes that all the elements in one list are distinct.
--   
--   listReplace itself is broken as of brick-0.2 due to a bogus
--   implementation of the <tt>merge</tt> function.
listSimpleReplace :: Eq e => Vector e -> List n e -> List n e


-- | TODO Use the built-in wrapping feature in brick-0.20
module Brick.Widgets.WrappedText

-- | Widget like <a>txt</a>, but wrap all lines to fit on the screen.
--   
--   Doesn't do word wrap, just breaks the line whenever the maximum width
--   is exceeded.
wrappedText :: Text -> Widget n


-- | Compatibility module to bridge the gap between megaparsec-5 and
--   megaparsec-6
--   
--   Import this instead of Text.Megaparsec, Text.Megaparsec.Char and
--   Text.Megaparsec.Text
module Text.Megaparsec.Compat

-- | Same as the type in Text.Megaparsec.Text from megaparsec-5
type Parser = Parsec Dec Text

-- | Custom error type for when no custom errors are needed
type Dec = Void

-- | Reimplementation of <a>string</a>, but specialized to <a>Text</a>.
string :: MonadParsec e s m => Tokens s -> m (Tokens s)

-- | Custom error type that mimics FancyError of megaparsec-6 but retains
--   information about unexpected and expected tokens.
data CustomError e

-- | Wrap a custom error type into a <a>ParseError</a>.
mkCustomError :: SourcePos -> e -> ParseError t (CustomError e)

-- | Add a custom error to an already existing error.
--   
--   This retains the original information such as expected and unexpected
--   tokens as well as the source position.
addCustomError :: Ord e => ParseError Char (CustomError e) -> e -> ParseError Char (CustomError e)

-- | Like <a>parse</a>, but start at a specific source position instead of
--   0.
parseWithStart :: (Stream s, Ord e) => Parsec e s a -> SourcePos -> s -> Either (ParseError (Token s) e) a
instance GHC.Classes.Ord e => GHC.Classes.Ord (Text.Megaparsec.Compat.CustomError e)
instance GHC.Show.Show e => GHC.Show.Show (Text.Megaparsec.Compat.CustomError e)
instance GHC.Classes.Eq e => GHC.Classes.Eq (Text.Megaparsec.Compat.CustomError e)
instance Text.Megaparsec.Error.ShowErrorComponent e => Text.Megaparsec.Error.ShowErrorComponent (Text.Megaparsec.Compat.CustomError e)

module DateParser
data DateFormat
parseDateFormat :: Text -> Either Text DateFormat

-- | Corresponds to %d[.[%m[.[%y]]]]
german :: DateFormat
parseDate :: Day -> DateFormat -> Text -> Either Text Day

-- | Parse text with given format and fill in missing fields with todays
--   date.
parseDateWithToday :: DateFormat -> Text -> IO (Either Text Day)
parseHLDate :: Day -> Text -> Either Text Day
parseHLDateWithToday :: Text -> IO (Either Text Day)
printDate :: DateFormat -> Day -> Text

-- | Computes a relative date by the given weekday
--   
--   Returns the first weekday with index wday, that's before the current
--   date.
weekDay :: Int -> Day -> Day
instance GHC.Show.Show DateParser.Direction
instance GHC.Classes.Eq DateParser.Direction
instance GHC.Show.Show a => GHC.Show.Show (DateParser.IncompleteDate a)
instance GHC.Base.Functor DateParser.IncompleteDate
instance GHC.Base.Monoid a => GHC.Base.Monoid (DateParser.IncompleteDate a)
instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (DateParser.IncompleteDate a)
instance GHC.Show.Show DateParser.DateFormat
instance GHC.Classes.Eq DateParser.DateFormat
instance GHC.Classes.Eq DateParser.DateSpec
instance GHC.Show.Show DateParser.DateSpec


-- | Applicative config parser.
--   
--   This parses config files in the style of optparse-applicative. It
--   supports automatic generation of a default config both as datatype and
--   in printed form.
--   
--   Example:
--   
--   <pre>
--   data Config = Config
--     { test :: Text
--     , foobar :: Int
--     }
--   
--   confParser :: ConfParser Config
--   confParser = Config
--            &lt;$&gt; option "test" "default value" "Help for test"
--            &lt;*&gt; option "foobar" 42 "Help for foobar"
--   </pre>
--   
--   This parses a config file like the following:
--   
--   <pre>
--   # This is a comment
--   test = "something"
--   foobar = 23
--   </pre>
module ConfigParser

-- | The main parser type. Use <a>option</a> and the <a>Applicative</a>
--   instance to create those.
type OptParser a = Ap Option a

-- | Parse a config file from a <a>Text</a>.
parseConfig :: FilePath -> Text -> OptParser a -> Either CustomParseError a

-- | Parse a config file from an actual file in the filesystem.
parseConfigFile :: FilePath -> OptParser a -> IO (Either CustomParseError a)

-- | <a>OptParser</a> that parses one option.
--   
--   Can be combined with the <a>Applicative</a> instance for
--   <a>OptParser</a>. See the module documentation for an example.
option :: OptionArgument a => Text -> a -> Text -> OptParser a
customOption :: Text -> a -> Text -> Text -> Text -> OParser a -> OptParser a

-- | Returns the default value of a given parser.
--   
--   This default value is computed from the default arguments of the
--   <a>option</a> constructor. For the parser from the module description,
--   the default value would be:
--   
--   <pre>
--   Config { test = "default value"
--          , foobar :: 42
--          }
--   </pre>
parserDefault :: OptParser a -> a

-- | Generate the default config file.
--   
--   This returns a valid config file, filled with the default values of
--   every option and using the help string of these options as comments.
parserExample :: OptParser a -> Text

-- | Errors that can occur during parsing. Use the <a>Show</a> instance for
--   printing.
data ConfParseError
type OParser = Parsec (CustomError ConfParseError) Text

-- | An option in the config file. Use <a>option</a> as a smart
--   constructor.
data Option a

-- | Class for supported option types.
--   
--   At the moment, orphan instances are not supported
class OptionArgument a
instance GHC.Show.Show ConfigParser.Assignment
instance GHC.Show.Show ConfigParser.AssignmentValue
instance GHC.Base.Functor ConfigParser.Option
instance GHC.Show.Show ConfigParser.ConfParseError
instance GHC.Classes.Ord ConfigParser.ConfParseError
instance GHC.Classes.Eq ConfigParser.ConfParseError
instance ConfigParser.OptionArgument GHC.Types.Int
instance ConfigParser.OptionArgument GHC.Integer.Type.Integer
instance ConfigParser.OptionArgument GHC.Base.String
instance ConfigParser.OptionArgument Data.Text.Internal.Text
instance Text.Megaparsec.Error.ShowErrorComponent ConfigParser.ConfParseError

module AmountParser
parseAmount :: Journal -> Text -> Either String MixedAmount

module Model
data Step
DateQuestion :: Comment -> Step
DescriptionQuestion :: Day -> Comment -> Step
AccountQuestion :: Transaction -> Comment -> Step
AmountQuestion :: AccountName -> Transaction -> Comment -> Step
FinalQuestion :: Transaction -> Duplicate -> Step
data MaybeStep
Finished :: Transaction -> MaybeStep
Step :: Step -> MaybeStep
data MatchAlgo
Fuzzy :: MatchAlgo
Substrings :: MatchAlgo
nextStep :: Journal -> DateFormat -> Either Text Text -> Step -> IO (Either Text MaybeStep)

-- | Reverses the last step.
--   
--   Returns (Left errorMessage), if the step can't be reversed
undo :: Step -> Either Text Step
context :: Journal -> MatchAlgo -> DateFormat -> Text -> Step -> IO [Text]

-- | Suggest the initial text of the entry box for each step
--   
--   For example, it suggests today for the date prompt
suggest :: Journal -> DateFormat -> Step -> IO (Maybe Text)
setCurrentComment :: Comment -> Step -> Step
getCurrentComment :: Step -> Comment
setTransactionComment :: Comment -> Step -> Step
getTransactionComment :: Step -> Comment

-- | All accounts occuring in the journal sorted in descending order of
--   appearance.
accountsByFrequency :: Journal -> [AccountName]

-- | Deterimine if a given transaction already occurs in the journal
--   
--   This function ignores certain attributes of transactions, postings and
--   amounts that are either artifacts of knot-tying or are purely for
--   presentation.
--   
--   See the various ...attributes functions in the where clause for
--   details.
isDuplicateTransaction :: Journal -> Transaction -> Bool
instance GHC.Show.Show Model.MatchAlgo
instance GHC.Classes.Eq Model.MatchAlgo
instance GHC.Show.Show Model.MaybeStep
instance GHC.Classes.Eq Model.MaybeStep
instance GHC.Show.Show Model.Step
instance GHC.Classes.Eq Model.Step

module View
viewState :: Step -> Widget n
viewQuestion :: Step -> Widget n
viewContext :: (Ord n, Show n) => List n Text -> Widget n
viewSuggestion :: Maybe Text -> Widget n
viewMessage :: Text -> Widget n
