-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Well-typed, flexible and variadic printf for Haskell -- @package safe-printf @version 0.1.0.0 module Text.Printf.Safe.Core -- | Variadic function types. -- | Formatter type. type Formatter a = a -> String -- | Printf Format. data Printf xs EOS :: Printf [] (:<>) :: String -> Printf xs -> Printf xs (:%) :: Formatter x -> Printf xs -> Printf (x : xs) -- | Hetero list. data HList ts HNil :: HList [] (:-) :: a -> HList xs -> HList (a : xs) -- | Variadic version. printf :: Printf xs -> xs ~> String -- | HList version. printf' :: Printf ts -> HList ts -> String instance xs ~ '[] => IsString (Printf xs) module Text.Printf.Safe.Combinators -- | Append plain string to format. (><) :: Printf ts -> String -> Printf ts -- | Append formatter to format. (%) :: Printf ts -> (a -> String) -> Printf (ts <> '[a]) -- | Concatenate two prtinf formats. (+++) :: Printf ts -> Printf ps -> Printf (ts <> ps) -- | Format String as it is. s :: Formatter String -- | Formatter for Show instances. _S :: Show a => Formatter a -- | Converts ShowS function to Formatter. _shows :: (a -> ShowS) -> Formatter a -- | Format Integrals at base. base :: (Show a, Integral a) => a -> Maybe (Char, Int) -> Formatter a -- | No padding version of d'. d :: (Show a, Integral a) => Formatter a -- | Decimal formatter with padding. d' :: (Show a, Integral a) => Char -> Int -> Formatter a -- | No padding version of o'. o :: (Show a, Integral a) => Formatter a -- | Octal formatter with padding. o' :: (Show a, Integral a) => Char -> Int -> Formatter a -- | No padding version of b'. b :: (Show a, Integral a) => Formatter a -- | Binary formatter with padding. b' :: (Show a, Integral a) => Char -> Int -> Formatter a -- | No padding version of b'. h :: (Show a, Integral a) => Formatter a -- | Binary formatter with padding. h' :: (Show a, Integral a) => Char -> Int -> Formatter a -- | RealFloat formatter. f :: RealFloat a => Formatter a module Text.Printf.Safe.QQ -- | Quasiquoter for formatter. It supprots escape sequence. Formatter is -- prefixed by % and you can use %{hoge} to -- antiquotation. -- --
--   >>> :set -XQuasiQuotes
--   
--   >>> printf [fmt|Answer is: %d and %S|] 42 True
--   "Answer is: 42 and True"
--   
-- --
--   >>> printf [fmt|%02d%% of people answers %{show . not}.\n|] 4 False
--   "04% of people answers True.\n"
--   
-- -- Predefined formatters: -- -- fmt :: QuasiQuoter module Text.Printf.Safe