packages feed

formatting 6.2.3 → 6.2.4

raw patch · 3 files changed

+10/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Formatting: mapf :: (a -> b) -> Format r (b -> t) -> Format r (a -> t)
+ Formatting.Internal: instance GHC.Base.Functor (Formatting.Internal.Format r)
+ Formatting.Internal: mapf :: (a -> b) -> Format r (b -> t) -> Format r (a -> t)

Files

formatting.cabal view
@@ -1,5 +1,5 @@ name:                formatting-version:             6.2.3+version:             6.2.4 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. license:             BSD3
src/Formatting.hs view
@@ -25,6 +25,7 @@   (%.),   now,   later,+  mapf,   -- * Top-level functions   format,   sformat,@@ -39,4 +40,3 @@  import Formatting.Formatters import Formatting.Internal-
src/Formatting/Internal.hs view
@@ -43,6 +43,10 @@ newtype Format r a =   Format {runFormat :: (Builder -> r) -> a} +-- | Not particularly useful, but could be.+instance Functor (Format r) where+  fmap f (Format k) = Format (\br -> f (k br))+ -- | Useful instance for applying two formatters to the same input -- argument. For example: @format (year <> "/" % month) now@ will -- yield @"2015/01"@.@@ -116,6 +120,10 @@ -- | Monadic indexed bind for holey monoids. bind :: Format r a -> (Builder -> Format r' r) -> Format r' a m `bind` f = Format $ \k -> runFormat m (\a -> runFormat (f a) k)++-- | Functorial map over a formatter's input. Example: @format (mapf (drop 1) string) \"hello\"@+mapf :: (a -> b) -> Format r (b -> t) -> Format r (a -> t)+mapf f m = Format (\k -> runFormat m k . f)  -- | Format a value of type @a@ using a function of type @a -> -- 'Builder'@. For example, @later (f :: Int -> Builder)@ produces