-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Tracery-like randomized text interpolation -- -- Please see the README on GitHub at -- https://github.com/swizzard/interp#readme @package interp @version 1.0.0.0 module Data.Text.Interp.CLI -- | Record to hold CLI options data Input Input :: FilePath -> FilePath -> Input -- | path to the substitutions file [substF] :: Input -> FilePath -- | path to the interpolations file [interpF] :: Input -> FilePath -- | ParserInfo for Input opts :: ParserInfo Input module Data.Text.Interp.Types -- | A binding of a Key to a path of Keys data Binding Binding :: Key -> NonEmpty Key -> Binding [name] :: Binding -> Key [pathToBind] :: Binding -> NonEmpty Key type BindingMap = Map Key Subst type I = ExceptT Text IO -- | A segment of text to interpolate (or not) data IText -- | Raw text that doesn't need interpolation | Text that requires -- interpolation RawText :: Text -> IText ToInterpolate :: Maybe Binding -> [Key] -> IText -- | Optional binding [binding] :: IText -> Maybe Binding -- | Path of Keys to the value to interpolate [path] :: IText -> [Key] newtype Key Key :: Text -> Key [unKey] :: Key -> Text -- | The main substitution type, either a list, mapping, or single value data Subst -- | a list of values, one of which will be randomly selected SubstL :: [Subst] -> Subst -- | a mapping of Keys to values SubstM :: Map Key Subst -> Subst -- | a single value SubstV :: Text -> Subst -- | Helper function to build a Subst mapping substm :: [(Key, Subst)] -> Subst instance GHC.Show.Show Data.Text.Interp.Types.IText instance GHC.Classes.Eq Data.Text.Interp.Types.IText instance GHC.Show.Show Data.Text.Interp.Types.Binding instance GHC.Classes.Eq Data.Text.Interp.Types.Binding instance GHC.Show.Show Data.Text.Interp.Types.Subst instance GHC.Classes.Eq Data.Text.Interp.Types.Subst instance GHC.Show.Show Data.Text.Interp.Types.Key instance GHC.Base.Semigroup Data.Text.Interp.Types.Key instance GHC.Classes.Ord Data.Text.Interp.Types.Key instance GHC.Base.Monoid Data.Text.Interp.Types.Key instance Data.String.IsString Data.Text.Interp.Types.Key instance GHC.Classes.Eq Data.Text.Interp.Types.Key instance Data.Aeson.Types.FromJSON.FromJSON Data.Text.Interp.Types.Subst module Data.Text.Interp.Parse type Parser = Parsec Void Text -- | Parse ITexts itP :: Parser (NonEmpty IText) interpStart :: Text interpStop :: Text -- | parse raw text (i.e., text without interpolations) rawTextP :: Parser IText -- | parse text that needs interpolation toInterpolateP :: Parser IText -- | parse interpolation instructions (with or without binding) interP :: Parser IText -- | parse interpolation that needs binding bindP :: Parser IText -- | parse interpolation that doesn't need binding keyP :: Parser IText -- | parse a single key key :: Parser Key -- | parse a list of keys keys :: Parser [Key] module Data.Text.Interp.Get -- | Randomly retrieve a value out of a Subst mapping get :: Subst -> [Key] -> BindingMap -> I Subst module Data.Text.Interp.Interpolate -- | Record holding intermediary interpolation state data IState IState :: Text -> BindingMap -> IState -- | interpolated text so far [acc] :: IState -> Text -- | mapping of bound variables [bm] :: IState -> BindingMap newIState :: IState -- | Build interpolated text out of a Subst mapping and a list of -- segments to interpolate interp :: Subst -> NonEmpty IText -> I Text -- | Interpolate a single segment interp' :: Subst -> IState -> IText -> I IState module Data.Text.Interp -- | ParserInfo for Input opts :: ParserInfo Input -- | Generate interpolated text within a I monad doInterp :: FilePath -> FilePath -> I Text -- | Record to hold CLI options data Input Input :: FilePath -> FilePath -> Input -- | path to the substitutions file [substF] :: Input -> FilePath -- | path to the interpolations file [interpF] :: Input -> FilePath