-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Quasiquotations for a python like interpolated string formater -- -- Quasiquotations for a python like interpolated string formater. @package PyF @version 0.6.0.2 -- | Formatters for integral / fractional and strings. -- -- Is support: -- -- For all types: -- -- -- -- For floating: -- -- -- -- For integrals: -- -- module PyF.Formatters -- | Format a string formatString :: Maybe (Int, AlignMode 'AlignAll, Char) -> Maybe Int -> String -> String -- | Format an integral number formatIntegral :: (Show i, Integral i) => Format t t' 'Integral -> SignMode -> Maybe (Int, AlignMode k, Char) -> Maybe (Int, Char) -> i -> String -- | Format a fractional number formatFractional :: (RealFloat f) => Format t t' 'Fractional -> SignMode -> Maybe (Int, AlignMode k, Char) -> Maybe (Int, Char) -> Maybe Int -> f -> String -- | This formatter support alternate version data AltStatus CanAlt :: AltStatus NoAlt :: AltStatus -- | This formatter support Upper case version data UpperStatus CanUpper :: UpperStatus NoUpper :: UpperStatus -- | This formatter formats an integral or a fractional data FormatType Fractional :: FormatType Integral :: FormatType -- | All the Formatters data Format (k :: AltStatus) (k' :: UpperStatus) (k'' :: FormatType) [Decimal] :: Format 'NoAlt 'NoUpper 'Integral [Character] :: Format 'NoAlt 'NoUpper 'Integral [Binary] :: Format 'CanAlt 'NoUpper 'Integral [Hexa] :: Format 'CanAlt 'CanUpper 'Integral [Octal] :: Format 'CanAlt 'NoUpper 'Integral [Fixed] :: Format 'CanAlt 'CanUpper 'Fractional [Exponent] :: Format 'CanAlt 'CanUpper 'Fractional [Generic] :: Format 'CanAlt 'CanUpper 'Fractional [Percent] :: Format 'CanAlt 'NoUpper 'Fractional [Alternate] :: Format 'CanAlt u f -> Format 'NoAlt u f [Upper] :: Format alt 'CanUpper f -> Format 'NoAlt 'NoUpper f -- | Sign handling data SignMode -- | Display - sign and + sign Plus :: SignMode -- | Only display - sign Minus :: SignMode -- | Display - sign and a space for positive numbers Space :: SignMode -- | Existential version of AlignMode data AnyAlign [AnyAlign] :: AlignMode (k :: AlignForString) -> AnyAlign -- | Alignement data AlignMode (k :: AlignForString) -- | Left padding [AlignLeft] :: AlignMode 'AlignAll -- | Right padding [AlignRight] :: AlignMode 'AlignAll -- | Padding will be added between the sign and the number [AlignInside] :: AlignMode 'AlignNumber -- | Padding will be added around the valueber [AlignCenter] :: AlignMode 'AlignAll getAlignForString :: AlignMode k -> Maybe (AlignMode 'AlignAll) data AlignForString AlignAll :: AlignForString AlignNumber :: AlignForString instance GHC.Show.Show PyF.Formatters.Repr instance GHC.Show.Show PyF.Formatters.Sign instance GHC.Show.Show PyF.Formatters.AlignForString instance GHC.Show.Show PyF.Formatters.SignMode instance GHC.Show.Show (PyF.Formatters.AlignMode k) instance GHC.Show.Show PyF.Formatters.AnyAlign instance Language.Haskell.TH.Syntax.Lift PyF.Formatters.AnyAlign instance Language.Haskell.TH.Syntax.Lift (PyF.Formatters.AlignMode k) instance Language.Haskell.TH.Syntax.Lift PyF.Formatters.SignMode instance Language.Haskell.TH.Syntax.Lift (PyF.Formatters.Format k k' k'') -- | This module provides a parser for python format string mini -- language. module PyF.Internal.PythonSyntax -- | Parse a string, returns a list of raw string or replacement fields -- --
--   >>> import Text.Megaparsec
--   
--   >>> parse parsePythonFormatString "" "hello {1+1:>10.2f}"
--   Right [
--          Raw "hello ",
--          Replacement "1+1"
--          (
--          Just (FormatMode
--                         (Padding 10 (Just (Nothing,AnyAlign AlignRight)))
--                         (FixedF (Precision 2) NormalForm Minus)
--                          Nothing))]
--   
parsePythonFormatString :: Parser [Item] -- | A format string is composed of many chunks of raw string or -- replacement data Item -- | A raw string Raw :: String -> Item -- | A replacement string, composed of an arbitrary Haskell expression -- followed by an optional formatter Replacement :: String -> (Maybe FormatMode) -> Item -- | A Formatter, listing padding, format and and grouping char data FormatMode FormatMode :: Padding -> TypeFormat -> (Maybe Char) -> FormatMode -- | Padding, containing the padding width, the padding char and the -- alignement mode data Padding PaddingDefault :: Padding Padding :: Integer -> (Maybe (Maybe Char, AnyAlign)) -> Padding -- | Floating point precision data Precision PrecisionDefault :: Precision Precision :: Integer -> Precision -- | All formating type data TypeFormat -- | Default, depends on the infered type of the expression DefaultF :: Precision -> SignMode -> TypeFormat -- | Binary, such as `0b0121` BinaryF :: AlternateForm -> SignMode -> TypeFormat -- | Character, will convert an integer to its character representation CharacterF :: TypeFormat -- | Decimal, base 10 integer formatting DecimalF :: SignMode -> TypeFormat -- | Exponential notation for floatting points ExponentialF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | Exponential notation with capitalised e ExponentialCapsF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | Fixed number of digits floating point FixedF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | Capitalized version of the previous FixedCapsF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | General formatting: FixedF or ExponentialF depending on -- the number magnitude GeneralF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | Same as GeneralF but with upper case E and infinite / -- NaN GeneralCapsF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | Octal, such as 00245 OctalF :: AlternateForm -> SignMode -> TypeFormat -- | Simple string StringF :: Precision -> TypeFormat -- | Hexadecimal, such as 0xaf3e HexF :: AlternateForm -> SignMode -> TypeFormat -- | Hexadecimal with capitalized letters, such as 0XAF3E HexCapsF :: AlternateForm -> SignMode -> TypeFormat -- | Percent representation PercentF :: Precision -> AlternateForm -> SignMode -> TypeFormat -- | If the formatter use its alternate form data AlternateForm AlternateForm :: AlternateForm NormalForm :: AlternateForm -- | Default formating mode, no padding, default precision, no grouping, no -- sign handling instance GHC.Show.Show PyF.Internal.PythonSyntax.Item instance GHC.Show.Show PyF.Internal.PythonSyntax.FormatMode instance GHC.Show.Show PyF.Internal.PythonSyntax.TypeFormat instance GHC.Show.Show PyF.Internal.PythonSyntax.AlternateForm instance GHC.Show.Show PyF.Internal.PythonSyntax.TypeFlag instance GHC.Show.Show PyF.Internal.PythonSyntax.Precision instance GHC.Show.Show PyF.Internal.PythonSyntax.Padding instance Language.Haskell.TH.Syntax.Lift PyF.Internal.PythonSyntax.Precision instance Language.Haskell.TH.Syntax.Lift PyF.Internal.PythonSyntax.Padding -- | This module uses the python mini language detailed in -- PythonSyntax to build an template haskell expression which -- represents a Format. module PyF.Internal.QQ -- | Parse a string and return a formatter for it toExp :: String -> Q Exp instance (TypeError ...) => PyF.Internal.QQ.Categorise PyF.Internal.QQ.DisableForString Data.Text.Internal.Lazy.Text instance (TypeError ...) => PyF.Internal.QQ.Categorise PyF.Internal.QQ.DisableForString Data.Text.Internal.Text instance (TypeError ...) => PyF.Internal.QQ.Categorise PyF.Internal.QQ.DisableForString GHC.Base.String instance PyF.Internal.QQ.Categorise PyF.Internal.QQ.EnableForString Data.Text.Internal.Lazy.Text instance PyF.Internal.QQ.Categorise PyF.Internal.QQ.EnableForString Data.Text.Internal.Text instance PyF.Internal.QQ.Categorise PyF.Internal.QQ.EnableForString GHC.Base.String instance PyF.Internal.QQ.Categorise k GHC.Integer.Type.Integer instance PyF.Internal.QQ.Categorise k GHC.Types.Int instance PyF.Internal.QQ.Categorise k GHC.Int.Int8 instance PyF.Internal.QQ.Categorise k GHC.Int.Int16 instance PyF.Internal.QQ.Categorise k GHC.Int.Int32 instance PyF.Internal.QQ.Categorise k GHC.Int.Int64 instance PyF.Internal.QQ.Categorise k GHC.Natural.Natural instance PyF.Internal.QQ.Categorise k GHC.Types.Word instance PyF.Internal.QQ.Categorise k GHC.Word.Word8 instance PyF.Internal.QQ.Categorise k GHC.Word.Word16 instance PyF.Internal.QQ.Categorise k GHC.Word.Word32 instance PyF.Internal.QQ.Categorise k GHC.Word.Word64 instance PyF.Internal.QQ.Categorise k GHC.Types.Float instance PyF.Internal.QQ.Categorise k GHC.Types.Double -- | A lot of quasiquoters to format and interpolate string expression module PyF -- | Returns an expression usable with Formatting.format (and similar -- functions) f :: QuasiQuoter -- | Generic formatter, can format an expression to (lazy) Text, String, -- Builder and IO () depending on type inference f' :: QuasiQuoter -- | Format the format string and directly print it to stdout fIO :: QuasiQuoter -- | Format the format string as a String fString :: QuasiQuoter -- | Format the format string as a Builder fBuilder :: QuasiQuoter -- | Format the format string as a Lazy Text fLazyText :: QuasiQuoter -- | Format the format string as a strict Text fStrictText :: QuasiQuoter runFormat :: Format r a -> Builder -> r -> a -- | Run the formatter and return a lazy Text value. format :: () => Format Text a -> a -- | Run the formatter and return a strict Text value. sformat :: () => Format Text a -> a -- | Run the formatter and return a Builder value. bprint :: () => Format Builder a -> a -- | Run the formatter and print out the text to stdout. fprint :: () => Format IO () a -> a -- | Run the formatter and put the output onto the given Handle. hprint :: () => Handle -> Format IO () a -> a instance PyF.MagicFormat (GHC.Types.IO ()) instance PyF.MagicFormat [GHC.Types.Char] instance PyF.MagicFormat Data.Text.Internal.Text instance PyF.MagicFormat Data.Text.Internal.Lazy.Text instance PyF.MagicFormat Data.Text.Internal.Builder.Builder