-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type-safe printf from parsing GHC TypeLits Symbol -- -- An extensible and type-safe printf from parsing GHC TypeLits Symbol -- literals, matching the semantics of P.printf from -- Text.Printf in base. The difference is that the variants -- here will always fail to compile if given arguments of the wrong type -- (or too many or too little arguments). Most of the variants also -- provide useful type feedback, telling you the type of arguments it -- expects and how many when queried with :t or with typed -- holes. -- -- See README and documentation of GHC.TypeLits.Printf for more -- information @package typelits-printf @version 0.3.0.0 -- | Internal workings of the printf mechanisms, exposed for potential -- debugging purposes. -- -- Please do not use this module for anything besides debugging, as is -- definitely very unstable and might go away or change dramatically -- between versions. module GHC.TypeLits.Printf.Internal type ParseFmtStr (str :: Symbol) = EvalParser FmtStrParser str type ParseFmtStr_ (str :: Symbol) = EvalParser_ FmtStrParser str type ParseFmt (str :: Symbol) = EvalParser FFParser str type ParseFmt_ (str :: Symbol) = EvalParser_ FFParser str -- | Whether to left-adjust or zero-pad a field. These are mutually -- exclusive, with LeftAdjust taking precedence. data FormatAdjustment LeftAdjust :: FormatAdjustment ZeroPad :: FormatAdjustment type family ShowFormat (x :: k) :: Symbol -- | How to handle the sign of a numeric field. These are mutually -- exclusive, with SignPlus taking precedence. data FormatSign SignPlus :: FormatSign SignSpace :: FormatSign data WidthMod WMhh :: WidthMod WMh :: WidthMod WMl :: WidthMod WMll :: WidthMod WML :: WidthMod data Flags Flags :: Maybe FormatAdjustment -> Maybe FormatSign -> Bool -> Flags [fAdjust] :: Flags -> Maybe FormatAdjustment [fSign] :: Flags -> Maybe FormatSign [fAlternate] :: Flags -> Bool type EmptyFlags = 'Flags 'Nothing :: Maybe FormatAdjustment 'Nothing :: Maybe FormatSign 'False data FieldFormat FF :: Flags -> Maybe Nat -> Maybe Nat -> Maybe WidthMod -> Char -> FieldFormat [fmtFlags] :: FieldFormat -> Flags [fmtWidth] :: FieldFormat -> Maybe Nat [fmtPrecision] :: FieldFormat -> Maybe Nat [fmtWidthMod] :: FieldFormat -> Maybe WidthMod [fmtChar] :: FieldFormat -> Char type family Demote k = (a :: Type) | a -> k class Reflect (x :: a) reflect :: Reflect x => p x -> Demote a -- | Typeclass associating format types (d, f, etc.) with -- the types that can be formatted by them. -- -- You can extend the printf methods here for your own types by writing -- your instances here. class FormatType (t :: Char) a formatArg :: FormatType t a => p t -> a -> FieldFormat -> ShowS ($dmformatArg) :: (FormatType t a, PrintfArg a) => p t -> a -> FieldFormat -> ShowS class Printf (str :: Symbol) fun -- | A version of printf taking an explicit proxy, which allows -- usage without TypeApplications -- --
--   >>> putStrLn $ printf_ (Proxy :: Proxy "You have %.2f dollars, %s") 3.62 "Luigi"
--   You have 3.62 dollars, Luigi
--   
printf_ :: Printf str fun => p str -> fun -- | The typeclass supporting polyarity used by printf. It works in -- mostly the same way as PrintfType from Text.Printf, and -- similar the same as FormatF. Ideally, you will never have to -- run into this typeclass or have to deal with it directly. -- -- Every item in the first argument of FormatFun is a chunk of the -- formatting string, split between format holes (Right) and -- string chunks (Left). -- -- If you want to see some useful error messages for feedback, -- pHelp can be useful: -- --
--   >>> pHelp $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
class FormatFun (ffs :: [Either Symbol FieldFormat]) fun formatFun :: FormatFun ffs fun => p ffs -> String -> fun -- | Utility type powering pfmt. See documentation for pfmt -- for more information on usage. -- -- Using OverloadedLabels, you never need to construct this -- directly can just write #f and a PFmt "f" -- will be generated. You can also create this using mkPFmt or -- mkPFmt_, in the situations where OverloadedLabels -- doesn't work or is not wanted. newtype PFmt (c :: k) PFmt :: FieldFormat -> PFmt (c :: k) -- | Parse and run a single format hole on a single vale. Can be -- useful for formatting individual items or for testing your own custom -- instances of FormatType. -- -- Usually meant to be used with OverloadedLabels: -- --
--   >>> pfmt #f 3.62
--   "3.62"
--   
-- -- However, current versions of GHC disallow labels that aren't valid -- identifier names, disallowing things like pfmt #.2f -- 3.62. While there is an -- <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst -- approved proposal> that allows this, if you are using an earlier -- GHC version, you can get around this using mkPFmt: -- --
--   >>> pfmt (mkPFmt @".2f") 3.6234124
--   "3.62"
--   
-- -- Ideally we'd want to be able to write -- --
--   >>> pfmt #.2f 3.6234124
--   "3.62"
--   
-- -- (which should be possible in GHC 8.10+) -- -- Note that the format string should not include the leading %. pfmt :: forall (c :: Char) a. FormatType c a => PFmt c -> a -> String -- | Useful for using pfmt without OverloadedLabels, or also -- when passing format specifiers that aren't currently allowed with -- OverloadedLabels until GHC 8.10+ (like #.2f). -- --
--   >>> pfmt (mkPFmt @".2f") 3.6234124
--   "3.62"
--   
mkPFmt :: forall (str :: Symbol) (ff :: FieldFormat) (f :: Flags) (w :: Maybe Nat) (q :: Maybe Nat) (m :: Maybe WidthMod) (c :: Char). (ff ~ ParseFmt_ str, Reflect ff, ff ~ 'FF f w q m c) => PFmt c -- | A version of mkPFmt that takes an explicit proxy input. -- --
--   >>> pfmt (mkPFmt_ (Proxy :: Proxy ".2f")) 3.6234124
--   "3.62"
--   
mkPFmt_ :: forall (str :: Symbol) (ff :: FieldFormat) (f :: Flags) (w :: Maybe Nat) (q :: Maybe Nat) (m :: Maybe WidthMod) (c :: Char) p. (ff ~ ParseFmt_ str, Reflect ff, ff ~ 'FF f w q m c) => p str -> PFmt c -- | A useful tool for helping the type system give useful errors for -- printf: -- --
--   >>> printf "You have ".2f" dollars, %s" 3.26 :: PHelp
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
-- -- Mostly useful if you want to force a useful type error to help see -- what is going on. -- -- See also pHelp newtype PHelp PHelp :: String -> PHelp -- | A useful helper function for helping the type system give useful -- errors for printf: -- --
--   >>> pHelp $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
-- -- Mostly useful if you want to force a useful type error to help see -- what is going on. [pHelp] :: PHelp -> String instance GHC.TypeLits.Printf.Internal.Unsatisfiable.Unsatisfiable (GHC.TypeLits.Printf.Internal.MissingError ff) => GHC.TypeLits.Printf.Internal.FormatFun' 'GHC.Types.False ff ffs notafun instance (afun GHC.Types.~ (arg -> fun), GHC.TypeLits.Printf.Parse.Reflect ff, ff GHC.Types.~ 'GHC.TypeLits.Printf.Parse.FF f w p m c, GHC.TypeLits.Printf.Internal.FormatType c arg, GHC.TypeLits.Printf.Internal.FormatFun ffs fun) => GHC.TypeLits.Printf.Internal.FormatFun' is_function ff ffs afun instance (GHC.Internal.TypeLits.KnownSymbol str, GHC.TypeLits.Printf.Internal.FormatFun ffs fun) => GHC.TypeLits.Printf.Internal.FormatFun ('GHC.Internal.Data.Either.Left str : ffs) fun instance GHC.TypeLits.Printf.Internal.FormatFun' (GHC.TypeLits.Printf.Internal.IsFunction afun) ff ffs afun => GHC.TypeLits.Printf.Internal.FormatFun ('GHC.Internal.Data.Either.Right ff : ffs) afun instance GHC.TypeLits.Printf.Internal.Unsatisfiable.Unsatisfiable ((('GHC.Internal.TypeError.Text "An extra argument of type " 'GHC.Internal.TypeError.:<>: 'GHC.Internal.TypeError.ShowType a) 'GHC.Internal.TypeError.:<>: 'GHC.Internal.TypeError.Text " was given to a call to printf.") 'GHC.Internal.TypeError.:$$: 'GHC.Internal.TypeError.Text "Either remove the argument, or rewrite the format string to include the appropriate hole") => GHC.TypeLits.Printf.Internal.FormatFun '[] (a -> b) instance (a GHC.Types.~ ()) => GHC.TypeLits.Printf.Internal.FormatFun '[] (GHC.Types.IO a) instance GHC.TypeLits.Printf.Internal.FormatFun '[] GHC.TypeLits.Printf.Internal.PHelp instance GHC.TypeLits.Printf.Internal.FormatFun '[] Data.Text.Internal.Lazy.Text instance GHC.TypeLits.Printf.Internal.FormatFun '[] Data.Text.Internal.Text instance (a GHC.Types.~ GHC.Internal.Base.String) => GHC.TypeLits.Printf.Internal.FormatFun '[] a instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'c' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Types.Char instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'g' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'f' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'e' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'G' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'F' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'E' GHC.Types.Double instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'g' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'f' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'e' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'G' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'F' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'E' GHC.Types.Float instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Base.String instance Text.Printf.IsChar c => GHC.TypeLits.Printf.Internal.FormatType 's' [c] instance GHC.TypeLits.Printf.Internal.FormatType 'v' Data.Text.Internal.Lazy.Text instance GHC.TypeLits.Printf.Internal.FormatType 's' Data.Text.Internal.Lazy.Text instance GHC.TypeLits.Printf.Internal.FormatType 'v' Data.Text.Internal.Text instance GHC.TypeLits.Printf.Internal.FormatType 's' Data.Text.Internal.Text instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Types.Int instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Int.Int16 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Int.Int32 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Int.Int64 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Int.Int8 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Num.Integer.Integer instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Num.Natural.Natural instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Types.Word instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'c' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Word.Word16 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Word.Word32 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Word.Word64 instance GHC.TypeLits.Printf.Internal.FormatType 'x' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'v' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'u' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'o' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'd' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'c' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'b' GHC.Internal.Word.Word8 instance GHC.TypeLits.Printf.Internal.FormatType 'X' GHC.Internal.Word.Word8 instance (ff GHC.Types.~ GHC.TypeLits.Printf.Parse.ParseFmt_ str, GHC.TypeLits.Printf.Parse.Reflect ff, ff GHC.Types.~ 'GHC.TypeLits.Printf.Parse.FF f w p m c) => GHC.Internal.OverloadedLabels.IsLabel str (GHC.TypeLits.Printf.Internal.PFmt c) instance (ffs GHC.Types.~ GHC.TypeLits.Printf.Parse.ParseFmtStr_ str, GHC.TypeLits.Printf.Internal.FormatFun ffs fun) => GHC.TypeLits.Printf.Internal.Printf str fun -- | An extensible and type-safe printf from parsing GHC TypeLits Symbol -- literals, matching the semantics of printf from -- Text.Printf in base. The difference is that your -- printfs will always fail to compile if given arguments of the -- wrong type (or too many or too little arguments). It also allows you -- to use types to help your development, by telling you the type of -- arguments it expects and how many when queried with :t or -- with typed holes. See documentation in Text.Printf for details -- on how this formats items of various types, and the differences with C -- printf(3). -- -- See printf for the main function, or printf' if you are -- on GHC 9.10 and later. -- -- You can extend functionality with formatting for your own types by -- providing instances of FormatType. -- -- Also in this module is pfmt, which allows you to format -- individual items according to a single format specifier. module GHC.TypeLits.Printf -- | "Type-safe printf". Call it like printf "you have %.02f -- dollars, %s". -- --
--   >>> putStrLn $ printf "You have %.2f dollars, %s" 3.62 "Luigi"
--   You have 3.62 dollars, Luigi
--   
-- -- NOTE: This is only type-safe in GHC 9.10 and above. A -- compatible version is provided in earlier versions that compiles (as -- long as you provide a string literal). For a type-safe version before -- GHC 9.10, use printf'. -- -- Anyway, looking at its type: -- --
--   >>> :t printf "You have %.2f dollars, %s"
--   (FormatType "f" arg1, FormatType "s" arg2)
--     => arg1 -> arg2 -> String
--   
-- -- It tells you that the result is an arg1 -> arg2 -> -- String: take two arguments, and return a String. -- The first argument must be an instance of FormatType -- "f" (things that can be formatted by %f) and the second -- argument must be an instance of FormatType "s" (things -- that can be formatted by %s). -- -- We can see this in action by progressively applying arguments: -- --
--   >>> :t printf "You have %.2f dollars, %s" 3.62
--   FormatType "s" arg1 => arg1 -> String
--   
--   >>> :t printf "You have %.2f dollars, %s" 3.62 "Luigi"
--   String
--   
-- -- The type errors for forgetting to apply an argument (or applying too -- many arguments) are pretty clear: -- --
--   >>> putStrLn $ printf "You have %.2f dollars, %s"
--   -- ERROR: Call to printf missing argument fulfilling "%.2f"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
--   >>> putStrLn $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
--   >>> putStrLn $ printf "You have %.2f dollars, %s" 3.62 "Luigi"
--   You have 3.62 dollars, Luigi
--   
--   >>> putStrLn $ printf "You have %.2f dollars, %s" 3.62 "Luigi" 72
--   -- ERROR: An extra argument of type Integer was given to a call to printf
--   -- Either remove the argument, or rewrite the format string to include the
--   -- appropriate hole.
--   
-- -- If you want to see some useful error messages for feedback, -- pHelp can be useful: -- --
--   >>> pHelp $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
-- -- Note that this also supports the "interpret as an IO action to print -- out results" functionality that Text.Printf supports. And, in -- GHC 9.10 and higher, this also supports returning strict Text -- and lazy Text as well. printf :: forall (str :: Symbol) -> Printf str fun => fun -- | A version of printf that uses -XTypeApplications -- syntax to provide the type-level string. Available since GHC 9.2 and -- higher. -- --
--   >>> putStrLn $ printf' @"You have %.2f dollars, %s" 3.62 "Luigi"
--   You have 3.62 dollars, Luigi
--   
printf' :: forall (str :: Symbol) fun. Printf str fun => fun -- | A version of printf taking an explicit proxy, which allows -- usage without TypeApplications -- --
--   >>> putStrLn $ printf_ (Proxy :: Proxy "You have %.2f dollars, %s") 3.62 "Luigi"
--   You have 3.62 dollars, Luigi
--   
printf_ :: Printf str fun => p str -> fun -- | A useful tool for helping the type system give useful errors for -- printf: -- --
--   >>> printf "You have ".2f" dollars, %s" 3.26 :: PHelp
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
-- -- Mostly useful if you want to force a useful type error to help see -- what is going on. -- -- See also pHelp data PHelp -- | A useful helper function for helping the type system give useful -- errors for printf: -- --
--   >>> pHelp $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
-- -- Mostly useful if you want to force a useful type error to help see -- what is going on. pHelp :: PHelp -> String -- | The typeclass supporting polyarity used by printf. It works in -- mostly the same way as PrintfType from Text.Printf, and -- similar the same as FormatF. Ideally, you will never have to -- run into this typeclass or have to deal with it directly. -- -- Every item in the first argument of FormatFun is a chunk of the -- formatting string, split between format holes (Right) and -- string chunks (Left). -- -- If you want to see some useful error messages for feedback, -- pHelp can be useful: -- --
--   >>> pHelp $ printf "You have %.2f dollars, %s" 3.62
--   -- ERROR: Call to printf missing argument fulfilling "%s"
--   -- Either provide an argument or rewrite the format string to not expect
--   -- one.
--   
class FormatFun (ffs :: [Either Symbol FieldFormat]) fun -- | Typeclass associating format types (d, f, etc.) with -- the types that can be formatted by them. -- -- You can extend the printf methods here for your own types by writing -- your instances here. class FormatType (t :: Char) a formatArg :: FormatType t a => p t -> a -> FieldFormat -> ShowS ($dmformatArg) :: (FormatType t a, PrintfArg a) => p t -> a -> FieldFormat -> ShowS -- | Parse and run a single format hole on a single vale. Can be -- useful for formatting individual items or for testing your own custom -- instances of FormatType. -- -- Usually meant to be used with OverloadedLabels: -- --
--   >>> pfmt #f 3.62
--   "3.62"
--   
-- -- However, current versions of GHC disallow labels that aren't valid -- identifier names, disallowing things like pfmt #.2f -- 3.62. While there is an -- <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst -- approved proposal> that allows this, if you are using an earlier -- GHC version, you can get around this using mkPFmt: -- --
--   >>> pfmt (mkPFmt @".2f") 3.6234124
--   "3.62"
--   
-- -- Ideally we'd want to be able to write -- --
--   >>> pfmt #.2f 3.6234124
--   "3.62"
--   
-- -- (which should be possible in GHC 8.10+) -- -- Note that the format string should not include the leading %. pfmt :: forall (c :: Char) a. FormatType c a => PFmt c -> a -> String -- | Utility type powering pfmt. See documentation for pfmt -- for more information on usage. -- -- Using OverloadedLabels, you never need to construct this -- directly can just write #f and a PFmt "f" -- will be generated. You can also create this using mkPFmt or -- mkPFmt_, in the situations where OverloadedLabels -- doesn't work or is not wanted. data PFmt (c :: k) -- | Useful for using pfmt without OverloadedLabels, or also -- when passing format specifiers that aren't currently allowed with -- OverloadedLabels until GHC 8.10+ (like #.2f). -- --
--   >>> pfmt (mkPFmt @".2f") 3.6234124
--   "3.62"
--   
mkPFmt :: forall (str :: Symbol) (ff :: FieldFormat) (f :: Flags) (w :: Maybe Nat) (q :: Maybe Nat) (m :: Maybe WidthMod) (c :: Char). (ff ~ ParseFmt_ str, Reflect ff, ff ~ 'FF f w q m c) => PFmt c -- | A version of mkPFmt that takes an explicit proxy input. -- --
--   >>> pfmt (mkPFmt_ (Proxy :: Proxy ".2f")) 3.6234124
--   "3.62"
--   
mkPFmt_ :: forall (str :: Symbol) (ff :: FieldFormat) (f :: Flags) (w :: Maybe Nat) (q :: Maybe Nat) (m :: Maybe WidthMod) (c :: Char) p. (ff ~ ParseFmt_ str, Reflect ff, ff ~ 'FF f w q m c) => p str -> PFmt c