-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Loader for data organized in a tree -- -- This library loads a string or file into a Tree. The hierarchy is -- given solely by the indentation, meaning that the input is -- human-readable. @package simtreelo @version 0.1.1.3 -- | This library loads trees that are described through text. In order to -- preserve readability, the hierarchy of the tree is give exclusively by -- the indentation level, which can be any number of spaces or tabs, as -- long as coherence is kept. -- -- The first line of the file describes the comment pattern. Every line -- contains one node of the tree, and the parent is determined by the -- indentation level, which is given by tabs or spaces. Whitespaces on -- the right of names are ignored. If the first line is empty, comments -- will be disabled. -- -- Example file: -- --
--   --
--   A node -- this is a comment
--     Child -- indentation is given by 2 spaces here
--   Brother
--     Debora
--       Edward
--   
module Data.Simtreelo -- | The input String must be organized in such a way that every -- child is one indentation lower than its parent, and all siblings have -- the same indentation. -- -- The String used for indentation is inferred from the first -- indentation depth -- -- The entire first line (except the newline character) represents the -- beginning of a comment -- -- Returns the first error message on failure, or the Tree on -- success loadString :: String -> Either [Char] [Tree [Char]] -- | Just applies loadString to the contents of the given file loadFile :: FilePath -> IO Either [Char] [Tree [Char]] -- | Writes a forest into a file using the Simtreelo format write :: [Tree [Char]] -> [Char] -> [Char] -> FilePath -> IO () -- | Transforms the forest into a string with the Simtreelo format toString :: [Tree [Char]] -> [Char] -> [Char] -- | Merges a tree into a forest, using available nodes when possible. -- -- | Every node must have a unique label merge :: Eq a => [Tree a] -> Tree a -> [Tree a]