-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple text based format strings with named identifiers. -- -- A simple library for format strings based on text and attoparsec. See -- the readme for more details. @package simple-text-format @version 0.1 module Data.Text.Format.Simple.Internal -- | The name of a referenced variable. type Name = Text data Part String :: Text -> Part NamedVar :: Name -> Part -- | A precompiled format string. Can be used to render several times. newtype Compiled Compiled :: [Part] -> Compiled [unCompiled] :: Compiled -> [Part] parse :: Text -> Either String Compiled parser :: Parser Compiled partParser :: Parser Part parseVar :: Parser Name parseString :: Parser Text instance GHC.Classes.Eq Data.Text.Format.Simple.Internal.Compiled instance GHC.Classes.Eq Data.Text.Format.Simple.Internal.Part instance GHC.Show.Show Data.Text.Format.Simple.Internal.Compiled instance Data.String.IsString Data.Text.Format.Simple.Internal.Compiled module Data.Text.Format.Simple -- | Compile a string to a format string and substitute the identifiers -- from the provided function into it. -- -- Fails if the string canno be parsed. Retuns the rendered string and a -- list of names which were used in the string but could not be resolved -- by the function. format :: Text -> SubMap -> Either String (Text, [Name]) -- | Compile a string to a format string and substitute the identifiers -- from the provided function into it. -- -- All errors are ignored. Parse failure is thrown as an error and the -- missing names are discarded. format' :: Text -> SubMap -> Text -- | Like format but with the string already compiled formatC :: Compiled -> SubMap -> (Text, [Name]) -- | Like format' but with the string already compiled formatC' :: Compiled -> SubMap -> Text -- | Resolver for names. type SubMap = Name -> Maybe Text -- | A precompiled format string. Can be used to render several times. data Compiled -- | The name of a referenced variable. type Name = Text