Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-formatting for openSUSE:Factory checked in at 2023-01-18 13:09:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-formatting (Old) and /work/SRC/openSUSE:Factory/.ghc-formatting.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-formatting" Wed Jan 18 13:09:51 2023 rev:6 rq:1059067 version:7.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-formatting/ghc-formatting.changes 2022-02-11 23:10:46.903184100 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-formatting.new.32243/ghc-formatting.changes 2023-01-18 13:10:04.196557471 +0100 @@ -1,0 +2,16 @@ +Fri Nov 25 23:41:48 UTC 2022 - Peter Simons <[email protected]> + +- Update formatting to version 7.2.0. + 7.2.0 + + * Added `FromBuilder` and `formatted` to simplify using formatting with other APIs (thanks Kyle Butt). + * Updated examples in comments to pass cabal-docspec (thanks Kyle Butt). + * Fixed haddock parsing in ghc-8.8.4 (thanks Oleg Grenrus). + * Generalised IO printing functions to use MonadIO (thanks Oleg Grenrus). + * Added `(%+)` and `(<%+>)` for appending formatters with a space between them, the latter also behaving like `(<>)` (thanks Oleg Grenrus). + * Allow building with Cabal 2.2 (thanks Jens Petersen). + * Removed unused dependency on `ghc-prim` + * Add a `no-double-conversion` build flag to optionally remove the dependency on `double-conversion` (Thanks Janus Troelsen) + * The `no-double-conversion` flag also fixes the build on GHC 9.4 on which `double-conversion` is apparently broken + +------------------------------------------------------------------- Old: ---- formatting-7.1.3.tar.gz formatting.cabal New: ---- formatting-7.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-formatting.spec ++++++ --- /var/tmp/diff_new_pack.wEGEsE/_old 2023-01-18 13:10:04.840561288 +0100 +++ /var/tmp/diff_new_pack.wEGEsE/_new 2023-01-18 13:10:04.844561312 +0100 @@ -19,13 +19,12 @@ %global pkg_name formatting %bcond_with tests Name: ghc-%{pkg_name} -Version: 7.1.3 +Version: 7.2.0 Release: 0 Summary: Combinator-based type-safe formatting (like printf() or FORMAT) License: BSD-3-Clause URL: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/2.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-clock-devel BuildRequires: ghc-double-conversion-devel @@ -59,7 +58,6 @@ %prep %autosetup -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ formatting-7.1.3.tar.gz -> formatting-7.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/CHANGELOG.md new/formatting-7.2.0/CHANGELOG.md --- old/formatting-7.1.3/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/CHANGELOG.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,15 @@ +7.2.0 + +* Added `FromBuilder` and `formatted` to simplify using formatting with other APIs (thanks Kyle Butt). +* Updated examples in comments to pass cabal-docspec (thanks Kyle Butt). +* Fixed haddock parsing in ghc-8.8.4 (thanks Oleg Grenrus). +* Generalised IO printing functions to use MonadIO (thanks Oleg Grenrus). +* Added `(%+)` and `(<%+>)` for appending formatters with a space between them, the latter also behaving like `(<>)` (thanks Oleg Grenrus). +* Allow building with Cabal 2.2 (thanks Jens Petersen). +* Removed unused dependency on `ghc-prim` +* Add a `no-double-conversion` build flag to optionally remove the dependency on `double-conversion` (Thanks Janus Troelsen) +* The `no-double-conversion` flag also fixes the build on GHC 9.4 on which `double-conversion` is apparently broken + 7.1.3 * Fix the GHCJS build by not using `double-conversion`, as it relies on a native C library which obviously isn't available in GHCJS (it is still used in native builds). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/README.md new/formatting-7.2.0/README.md --- old/formatting-7.1.3/README.md 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/README.md 2001-09-09 03:46:40.000000000 +0200 @@ -516,6 +516,22 @@ "Nope!" ``` +## Using it with other APIs + +As a convenience, we provide the `FromBuilder` typeclass and the `formatted` +combinator. `formatted` makes it simple to add formatting to any API that is +expecting a `Builder`, a strict or lazy `Text`, or a `String`. For example if +you have functions `logDebug`, `logWarning` and `logInfo` all of type +`Text -> IO ()` you can do the following: + +``` haskell +> formatted logDebug ("x is: " % int) x +> formatted logInfo ("y is: " % squared int) y +> formatted logWarning ("z is: " % braced int) z +``` + +The above example will work for either strict or lazy `Text` + ## Hacking ### Building with Nix diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/formatting.cabal new/formatting-7.2.0/formatting.cabal --- old/formatting-7.1.3/formatting.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/formatting.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ -cabal-version: 2.4 +cabal-version: 2.2 name: formatting -version: 7.1.3 +version: 7.2.0 synopsis: Combinator-based type-safe formatting (like printf() or FORMAT) description: Combinator-based type-safe formatting (like printf() or FORMAT), modelled from the HoleyMonoids package. . @@ -18,15 +18,15 @@ README.md tested-with: GHC == 8.4.4 , GHC == 8.6.5 - , GHC == 8.8.3 - , GHC == 8.10.1 - , GHC == 9.0.1 + , GHC == 8.8.4 + , GHC == 8.10.7 + , GHC == 9.0.2 + , GHC == 9.2.2 common deps build-depends: base >= 4.11 && < 5, - text >= 0.11.0.8, - ghc-prim, + text >= 0.11.0.8 -- Warnings list list taken from -- https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3 @@ -49,6 +49,11 @@ ghc-options: -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode +flag no-double-conversion + description: Avoid 'double-conversion' dependency, which is large and uses C code + manual: False + default: False + library import: deps hs-source-dirs: src @@ -58,7 +63,7 @@ scientific >= 0.3.0.0, time >= 1.5, transformers, - if !impl(ghcjs) + if !impl(ghcjs) && !flag(no-double-conversion) build-depends: double-conversion ^>= 2.0.2.0, exposed-modules: @@ -72,6 +77,7 @@ Formatting.Internal Formatting.Internal.Raw Formatting.Buildable + Formatting.FromBuilder other-modules: Data.Text.Format.Functions Data.Text.Format.Types @@ -79,7 +85,7 @@ test-suite formatting-test import: deps - build-depends: formatting, hspec, scientific + build-depends: formatting, hspec, scientific, time type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Data/Text/Format.hs new/formatting-7.2.0/src/Data/Text/Format.hs --- old/formatting-7.1.3/src/Data/Text/Format.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/src/Data/Text/Format.hs 2001-09-09 03:46:40.000000000 +0200 @@ -24,10 +24,10 @@ , shortest ) where -#ifdef ghcjs_HOST_OS -import Text.Printf -#else +#ifdef MIN_VERSION_double_conversion import Data.Double.Conversion.Text (toFixed, toShortest) +#else +import Numeric (showFFloat, showInt) #endif import qualified Formatting.Buildable as B import Data.Text.Format.Types (Hex(..)) @@ -53,26 +53,31 @@ Int -- ^ Number of digits of precision after the decimal. -> a -> Builder -#ifdef ghcjs_HOST_OS +#ifdef MIN_VERSION_double_conversion +fixed decs = fromText . toFixed decs . realToFrac +#else fixed decs = fromString . toFixed . realToFrac where toFixed :: Double -> String - toFixed = printf ("%f." ++ show decs) -#else -fixed decs = fromText . toFixed decs . realToFrac + toFixed dbl = showFFloat (Just decs) dbl "" #endif {-# NOINLINE[0] fixed #-} -- | Render a floating point number using the smallest number of -- digits that correctly represent it. shortest :: Real a => a -> Builder -#ifdef ghcjs_HOST_OS +#ifdef MIN_VERSION_double_conversion +shortest = fromText . toShortest . realToFrac +#else shortest = fromString . toShortest . realToFrac where toShortest :: Double -> String - toShortest = printf "%f" -#else -shortest = fromText . toShortest . realToFrac + toShortest dbl = + -- `showFFloat (Just 0) "" 1.0` gives "1.", but we want "1" + let intPart = (floor dbl :: Int) in + if dbl == (fromIntegral intPart) + then showInt intPart "" + else showFFloat Nothing dbl "" #endif {-# INLINE shortest #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Formatting/Combinators.hs new/formatting-7.2.0/src/Formatting/Combinators.hs --- old/formatting-7.1.3/src/Formatting/Combinators.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/src/Formatting/Combinators.hs 2001-09-09 03:46:40.000000000 +0200 @@ -111,6 +111,17 @@ import Formatting.Internal import Formatting.Formatters + +-- $setup +-- >>> import Formatting.Internal +-- >>> import Formatting.Formatters +-- >>> import qualified Data.Text.Lazy as TL +-- >>> _1 g (a, x) = fmap (\b -> (b, x)) $ g a +-- +-- We define a simplistic implementation of the lens _1, Not polymorphic in +-- tuple length, but it works for our example without requiring the lens +-- package. + -- | Render a Maybe value either as a default (if Nothing) or using the given formatter: -- -- >>> format (maybed "Goodbye" text) Nothing @@ -140,7 +151,7 @@ -- | Render the value in an Either: -- --- >>> format (eithered text int) (Left "Error!" +-- >>> format (eithered text int) (Left "Error!") -- "Error!" -- -- >>> format (eithered text int) (Right 69) @@ -285,7 +296,7 @@ -- | Drop the first n items from the list of items. -- --- >>> format (dropped 3 (list int) [1..6] +-- >>> format (dropped 3 (list int)) [1..6] -- "[4, 5, 6]" dropped :: Int -> Format r ([a] -> r) -> Format r ([a] -> r) dropped n = fmap (. drop n) @@ -327,7 +338,7 @@ -- two -- three -- --- >>> fprint (splatOn "," indentedLines text) "one,two,three" +-- >>> fprint (splatOn "," (indentedLines 4) text) "one,two,three" -- one -- two -- three @@ -420,10 +431,10 @@ -- | Truncate the formatted string at the end so that it is no more than the given number of characters in length, placing an ellipsis at the end such that it does not exceed this length. -- --- >>> format (truncated 5 text) "hello" +-- >>> format (ltruncated 5 text) "hello" -- "hello" -- --- >>> format (truncated 5 text) "hellos" +-- >>> format (ltruncated 5 text) "hellos" -- "he..." ltruncated :: Int64 -> Format r a -> Format r a ltruncated n = ctruncated (n - 3) 0 @@ -641,7 +652,7 @@ -- | Format a list of items, placing one per line, indented by the given number of spaces. -- --- >>> fprintLn ("The lucky numbers are:\n" % indentedLines 4 int) [7, 13, 1, 42] +-- >>> fprint ("The lucky numbers are:\n" % indentedLines 4 int) [7, 13, 1, 42] -- The lucky numbers are: -- 7 -- 13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Formatting/Formatters.hs new/formatting-7.2.0/src/Formatting/Formatters.hs --- old/formatting-7.1.3/src/Formatting/Formatters.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/src/Formatting/Formatters.hs 2001-09-09 03:46:40.000000000 +0200 @@ -68,6 +68,9 @@ import Data.Text.Lazy.Builder.Scientific import Numeric (showIntAtBase) +-- $setup +-- >>> import Formatting.Internal + -- | Output a lazy text. text :: Format r (Text -> r) text = later T.fromLazyText @@ -229,7 +232,7 @@ -- -- For example: -- --- >>> set -XOverloadedStrings +-- >>> :set -XOverloadedStrings -- >>> formatPeople = format (int % " " <> plural "person" "people" % ".") :: Int -> Data.Text.Lazy.Text -- >>> formatPeople 1 -- "1 person." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Formatting/FromBuilder.hs new/formatting-7.2.0/src/Formatting/FromBuilder.hs --- old/formatting-7.1.3/src/Formatting/FromBuilder.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/formatting-7.2.0/src/Formatting/FromBuilder.hs 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,61 @@ +{-# LANGUAGE FlexibleInstances #-} + +module Formatting.FromBuilder + ( FromBuilder(..) + , formatted + ) where + +import qualified Data.Text as T +import qualified Data.Text.Lazy as TL +import Data.Text.Lazy.Builder (Builder) +import qualified Data.Text.Lazy.Builder as TL +import Formatting.Internal (Format (..)) + +-- $setup +-- >>> import qualified Data.Text.Lazy as TL (Text) +-- >>> import qualified Data.Text.Lazy.IO as TL +-- >>> import qualified Data.Text as T (Text) +-- >>> import qualified Data.Text.IO as T +-- >>> import Formatting ((%)) +-- >>> import Formatting.Formatters (int) +-- >>> :set -XOverloadedStrings +-- >>> :set -XTypeApplications + +-- | Anything that can be created from a 'Builder'. +-- This class makes it easier to add formatting to other API's. +-- See 'formatted' for some examples of this class in action. +class FromBuilder a where + fromBuilder :: Builder -> a + +instance FromBuilder Builder where + fromBuilder = id + {-# INLINE fromBuilder #-} + +instance FromBuilder TL.Text where + fromBuilder = TL.toLazyText + {-# INLINE fromBuilder #-} + +instance FromBuilder T.Text where + fromBuilder = TL.toStrict . TL.toLazyText + {-# INLINE fromBuilder #-} + +instance FromBuilder [Char] where + fromBuilder = TL.unpack . TL.toLazyText + {-# INLINE fromBuilder #-} + +-- | Makes it easy to add formatting to any api that is expecting a builder, +-- a strict or lazy text, or a string. +-- It is essentially (flip runFormat), but with a more generous type due to +-- the typeclass. +-- +-- For example: +-- >>> formatted TL.putStr ("x is: " % int % "\n") 7 +-- x is: 7 +-- >>> formatted T.putStr ("x is: " % int % "\n") 7 +-- x is: 7 +-- >>> formatted (id @TL.Text) ("x is: " % int % "\n") 7 +-- "x is: 7\n" +-- >>> formatted (id @T.Text) ("x is: " % int % "\n") 7 +-- "x is: 7\n" +formatted :: FromBuilder t => (t -> o) -> Format o a -> a +formatted k f = runFormat f (k . fromBuilder) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Formatting/Internal.hs new/formatting-7.2.0/src/Formatting/Internal.hs --- old/formatting-7.1.3/src/Formatting/Internal.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/src/Formatting/Internal.hs 2001-09-09 03:46:40.000000000 +0200 @@ -6,7 +6,9 @@ module Formatting.Internal ( Format(..) , (%) + , (%+) , (%.) + , (<%+>) , now , bind , mapf @@ -23,6 +25,7 @@ ) where import Control.Category (Category(..)) +import Control.Monad.IO.Class (MonadIO (..)) import Data.Monoid import Data.String import qualified Data.Text as S (Text) @@ -36,6 +39,9 @@ import Prelude hiding ((.),id) import System.IO +-- $setup +-- >>> import Formatting.Formatters + -- | A formatter. When you construct formatters the first type -- parameter, @r@, will remain polymorphic. The second type -- parameter, @a@, will change to reflect the types of the data that @@ -80,6 +86,13 @@ Format (\k a -> runFormat m (\b1 -> runFormat n (\b2 -> k (b1 <> b2)) a) a) +-- | Like @(<>)@ except put a space between the two formatters. For example: +-- @format (year <%+> month <%+> dayOfMonth) now@ will yield @"2022 06 06"@ +(<%+>) :: Format r (a -> r) -> Format r (a -> r) -> Format r (a -> r) +m <%+> n = + Format (\k a -> + runFormat m (\b1 -> runFormat n (\b2 -> k (b1 <> TLB.singleton ' ' <> b2)) a) a) + -- | Useful instance for applying two formatters to the same input -- argument. For example: @format (year <> "/" % month) now@ will -- yield @"2015/01"@. @@ -87,7 +100,7 @@ mempty = Format (\k _ -> k mempty) -- | Useful instance for writing format string. With this you can --- write @"Foo"@ instead of @now "Foo!"@. +-- write @\"Foo\"@ instead of @now "Foo!"@. instance (a ~ r) => IsString (Format r a) where fromString = now . fromString @@ -137,6 +150,20 @@ (%) = (.) infixr 9 % +-- | Concatenate two formatters with a space in between. +-- +-- >>> :set -XOverloadedStrings +-- >>> format (int %+ "+" %+ int %+ "=" %+ int) 2 3 5 +-- "2 + 3 = 5" +-- +(%+) :: Format r a -> Format r' r -> Format r' a +f %+ g = + f `bind` + \a -> + g `bind` + \b -> now (a `mappend` TLB.singleton ' ' `mappend` b) +infixr 9 %+ + -- | Function compose two formatters. Will feed the result of one -- formatter into another. (%.) :: Format r (Builder -> r') -> Format r' a -> Format r a @@ -180,20 +207,20 @@ bformat m = runFormat m id -- | Run the formatter and print out the text to stdout. -fprint :: Format (IO ()) a -> a -fprint m = runFormat m (T.putStr . T.toLazyText) +fprint :: MonadIO m => Format (m ()) a -> a +fprint m = runFormat m (liftIO . T.putStr . T.toLazyText) -- | Run the formatter and print out the text to stdout, followed by a newline. -fprintLn :: Format (IO ()) a -> a -fprintLn m = runFormat m (T.putStrLn . T.toLazyText) +fprintLn :: MonadIO m => Format (m ()) a -> a +fprintLn m = runFormat m (liftIO . T.putStrLn . T.toLazyText) -- | Run the formatter and put the output onto the given 'Handle'. -hprint :: Handle -> Format (IO ()) a -> a -hprint h m = runFormat m (T.hPutStr h . T.toLazyText) +hprint :: MonadIO m => Handle -> Format (m ()) a -> a +hprint h m = runFormat m (liftIO . T.hPutStr h . T.toLazyText) -- | Run the formatter and put the output and a newline onto the given 'Handle'. -hprintLn :: Handle -> Format (IO ()) a -> a -hprintLn h m = runFormat m (T.hPutStrLn h . T.toLazyText) +hprintLn :: MonadIO m => Handle -> Format (m ()) a -> a +hprintLn h m = runFormat m (liftIO . T.hPutStrLn h . T.toLazyText) -- | Run the formatter and return a list of characters. formatToString :: Format String a -> a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/src/Formatting.hs new/formatting-7.2.0/src/Formatting.hs --- old/formatting-7.1.3/src/Formatting.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/src/Formatting.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,7 @@ {-# LANGUAGE RankNTypes #-} {-# OPTIONS -Wall #-} + -- | -- Module : Text.Format -- Copyright : (c) 2013 Chris Done, 2013 Shachaf Ben-Kiki @@ -14,6 +15,7 @@ -- Example: -- -- >>> format ("Person's name is " % text % ", age is " % hex) "Dave" 54 +-- "Person's name is Dave, age is 36" -- -- See "Formatting.Formatters" for a list of formatters. -- See "Formatting.Combinators" for a list of formatting combinators, for combining and altering formatters. @@ -22,7 +24,9 @@ ( Format, (%), + (%+), (%.), + (<%+>), now, later, mapf, @@ -37,11 +41,17 @@ hprint, hprintLn, formatToString, + formatted, -- * Formatting library module Formatting.Formatters, module Formatting.Combinators ) where + import Formatting.Formatters import Formatting.Combinators +import Formatting.FromBuilder import Formatting.Internal + +-- $setup +-- >>> :set -XOverloadedStrings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/formatting-7.1.3/test/Spec.hs new/formatting-7.2.0/test/Spec.hs --- old/formatting-7.1.3/test/Spec.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/formatting-7.2.0/test/Spec.hs 2001-09-09 03:46:40.000000000 +0200 @@ -8,6 +8,7 @@ import Data.Scientific import qualified Data.Semigroup import qualified Data.Text.Lazy as LT +import Data.Time (Day) import Formatting as F import Formatting.Time import Test.Hspec @@ -23,12 +24,12 @@ it "format (later id <> later id) \"x\"" $ format (later id Data.Semigroup.<> later id) "x" `shouldBe` "xx" describe "https://github.com/AJChapman/formatting/issues/31" $ - it "10^6-1" $ F.format F.int (10 ^ (16 :: Int) - 1 :: Int) `shouldBe` "9999999999999999" + it "10^16-1" $ F.format F.int (10 ^ (16 :: Int) - 1 :: Int) `shouldBe` "9999999999999999" describe "https://github.com/AJChapman/formatting/issues/28" $ do it "-100" $ sformat (groupInt 3 ',') (-100 :: Int) `shouldBe` "-100" it "-100,000,000" $ sformat (groupInt 3 ',') (-100000000 :: Int) `shouldBe` "-100,000,000" - it "100,000,000" $ sformat (groupInt 3 ',') (-100000000 :: Int) `shouldBe` "-100,000,000" + it "100,000,000" $ sformat (groupInt 3 ',') (100000000 :: Int) `shouldBe` "100,000,000" describe "https://github.com/bos/text-format/issues/18" $ do it "build (minBound :: Int)" $ format build (minBound :: Int64) `shouldBe` "-9223372036854775808" @@ -197,7 +198,7 @@ it "squared" $ format (squared int) 7 `shouldBe` "[7]" it "braced" $ format ("\\begin" % braced text) "section" `shouldBe` "\\begin{section}" it "angled" $ format (list (angled text)) ["html", "head", "title", "body", "div", "span"] `shouldBe` "[<html>, <head>, <title>, <body>, <div>, <span>]" - it "backticked" $ format ("Be sure to run " % backticked builder % " as root.") ":(){:|:&};:" `shouldBe` "Be sure to run `:(){:|:&};:` as root." + it "backticked" $ format ("Be sure to run" %+ backticked builder %+ "as root.") ":(){:|:&};:" `shouldBe` "Be sure to run `:(){:|:&};:` as root." describe "indenters" $ do it "indented" $ format (indented 4 int) 7 `shouldBe` " 7" @@ -219,3 +220,7 @@ it "binPrefix" $ format (binPrefix 16) 4097 `shouldBe` "0b0001000000000001" it "octPrefix" $ format (octPrefix 16) 4097 `shouldBe` "0o0000000000010001" it "hexPrefix" $ format (hexPrefix 16) 4097 `shouldBe` "0x0000000000001001" + + describe "mappend with added space (<%+>)" $ do + let testTime = (read "2022-06-06") :: Day + it "combines formatters, adding a space" $ format (year <%+> month <%+> dayOfMonth) testTime `shouldBe` "2022 06 06"
